in reply to Re^2: Regex and array
in thread Regex and array
Am I missing something?Yes, you are ignoring important warnings because you did not use strict and warnings.
One way to search an array for a specific value is to use grep. I think you are looking for something like this:
use strict; use warnings; my @array = qw( ciccio paperino palla gigio pluto ); my $test = 'pluto'; if (grep { $test eq $_ } @array ) { print "It matched!\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regex and array
by Deus Ex (Scribe) on May 25, 2010 at 13:07 UTC |