jeanluca has asked for the wisdom of the Perl Monks concerning the following question:
So, I only want $f to be 1 if the text 'abc' is present inside 1 of the array elements, or else $f should be zero!$a[0] = "a" ; $a[1] = "c" ; $a[2] = "abc" ; $a[3] = "b" ; ($f) = grep {$a[$_] =~ /^abc$/} 0..$#a) ? 1 : 0; if ( $f ) { print "YES\n" ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array seach
by ikegami (Patriarch) on Feb 17, 2006 at 18:40 UTC | |
by Aristotle (Chancellor) on Feb 20, 2006 at 00:22 UTC | |
by jeanluca (Deacon) on Feb 20, 2006 at 08:18 UTC | |
by ikegami (Patriarch) on Feb 20, 2006 at 14:52 UTC | |
|
Re: Array seach
by InfiniteSilence (Curate) on Feb 17, 2006 at 17:26 UTC |