- or download this
# Do this using GREP
my @people = ('Jacob Smith', 'Michael Brown', 'Joshua Smith', 'Matthew
Cope');
@smiths = grep(/smith/i, @people);
- or download this
No!
my $first = (grep /smith/i, @people)[0];
But inefficient, because it will grep more than necessary.
- or download this
my ( $first) = grep ...;
- or download this
my @l = qw( foo bar baz);
( my ( $first) = grep /ba/ => @l ) > 1 and warn "not unique\n";
print "first: $first\n";