|Just another Perl shrine|
in_array and skipping foreachby webchalkboard (Scribe)
|on Apr 13, 2005 at 14:28 UTC ( #447410=perlquestion: print w/replies, xml )||Need Help??|
webchalkboard has asked for the wisdom of the Perl Monks concerning the following question:
Just wondering how can I check if a value exists in an array in Perl? Then if it does, just skip to the next element...
In PHP you can use in_array or something, here is how I would write it long-hand in perl, but there must be a more succinct version as there always is in Perl ;) I don't even think this version will work exactly, as I want the 'next' statement to go to the next value in the outer foreach loop, rather than the one it is in.
Any ideas how I can make this better?
Learning without thought is labor lost; thought without learning is perilous. - ConfuciusWebChalkboard.com | For the love of art...
Back to Seekers of Perl Wisdom