in reply to Re^4: perldelta unclear on 'given's fate
in thread perldelta unclear on 'given's fate
It's essentially the same with For-If just the fall trough is inverse.
See provided code examples.
update
i.e. you need to terminate with explicit next statements to avoid fall through.
for ($var){ if (/abc/) { print "abc"} # falls through if (/def/) { print "def" ;next} if (/xyz/) { print "xyz" ;next} print "default"; }
Cheers Rolf
( addicted to the Perl Programming Language)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: perldelta unclear on 'given's fate
by Tommy (Chaplain) on Jan 05, 2014 at 21:15 UTC | |
Re^6: perldelta unclear on 'given's fate
by Bloodnok (Vicar) on Jan 06, 2014 at 14:18 UTC |
In Section
Seekers of Perl Wisdom