On Thu, 20 Feb 2014 15:05:42 -0600, Matt wrote:
>my @alarm = ("xyz", "abc");
>>my $name = "ab";
>>unless (grep {/$name/} @alarm) { # do this }
>If I set 'my $name = "abc";' it seems to match. But I want to match
>on "ab" as well.
It appears to do this already.
#!/usr/bin/perl -w
use 5.14.0;
> 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?
If I set 'my $name = "abc";' it seems to match. But I want to match
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
On Thu, 20 Feb 2014 13:04:56 -0600, 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?
>
Use word boundaries
#!/us
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?
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands,