in reply to better way to find list members?
print "I am here!" if grep {/$bar/} @foo;
Update and disclaimer: Yes, all the points below are correct, this was just a quick one-liner. Don't use it for things that might actually Take Time or Need To Be Efficient. Use one of the methods above.
On second thought, why should I be that lazy? Here's a rewrite to specs:
sub IsItThere($$) { my $testarray = shift; my $string = shift; for (@$testarray) { return 1 if $_ eq $string; ## Or... return 1 if /$string/i; etc. etc. } return 0; }
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: better way to find list members?
by japhy (Canon) on Oct 17, 2000 at 00:36 UTC |