![]() |
|
Just another Perl shrine | |
PerlMonks |
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: Hi Monks, 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? Cheers, Learning without thought is labor lost;
thought without learning is perilous. - Confucius
WebChalkboard.com | For the love of art...
Back to
Seekers of Perl Wisdom
|
|