in reply to Re: Perl 5.10: switch statement demo
in thread Perl 5.10: switch statement demo
You can use when in a for loop:
for (@items) { when (/^[A-Z]/) { say "Found a proper noun? $_"; } when (/[,.]/) { say "This word has punctuation: $_"; } say "This word seems uninteresting: $_"; }
In Section
Seekers of Perl Wisdom