bengmau has asked for the wisdom of the Perl Monks concerning the following question:
This won't work since 10,11,21 all have 1 in it.. I did some searching on this... can I do this?@array = (10,11,12,13,14,20,21,25); $x=1 if (grep /$x/,@array) { ... }
if (grep($_=$x, @array)) { }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check if a number is in a list
by crashtest (Curate) on Jun 26, 2005 at 02:36 UTC | |
|
Re: check if a number is in a list
by runrig (Abbot) on Jun 26, 2005 at 02:38 UTC | |
by davidrw (Prior) on Jun 26, 2005 at 03:12 UTC | |
by Ido (Hermit) on Jun 26, 2005 at 05:21 UTC | |
by 5mi11er (Deacon) on Jun 27, 2005 at 16:33 UTC | |
|
Re: check if a number is in a list
by neniro (Priest) on Jun 26, 2005 at 10:00 UTC |