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: $_"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl 5.10: switch statement demo
by LighthouseJ (Sexton) on Dec 20, 2007 at 18:43 UTC | |
by robin (Chaplain) on Dec 20, 2007 at 21:18 UTC |
In Section
Seekers of Perl Wisdom