in reply to Re: boolean IN(); function in perl like
in thread boolean IN(); function in perl like
I'm surprised to see only grep examples with "eq". You can also do this with regex interpolation (being careful to match the whole thing, of course):
print "found!" if grep(/^$e$/, @a);
This might be useful if, for example, you didn't care about matching case:
print "found!" if grep(/^$e$/i, @a);
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: boolean IN(); function in perl like
by gaal (Parson) on Jan 14, 2005 at 22:02 UTC |