On 02/20/2014 02:04 PM, Matt wrote:
Having trouble making this work.
my @alarm = ("xyz", "abc");
my $name = "ab";
unless (grep {/$name/} @alarm) { # do this }
Since "ab" is contained in the array I want it to NOT 'do this'. What
have I got wrong?
can you show this not working? it looks good to me. grep will return a
boolean value in scalar context.
this prints nothing. same logic.
perl -e '@a = qw( x y ); print "not found\n" unless grep /x/, @a'
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/