in reply to Foreach loop
Use grep with ^ and $ to match exactly 1
Update:if (my ($matched) = grep /^1$/, @array) { print "found it: $matched\n"; }
Corrected the code as marked by Bloodnok
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Foreach loop
by Bloodnok (Vicar) on Sep 27, 2013 at 10:35 UTC | |
by vinoth.ree (Monsignor) on Sep 27, 2013 at 11:36 UTC | |
|
Re^2: Foreach loop
by ww (Archbishop) on Sep 27, 2013 at 10:52 UTC |