http://qs1969.pair.com?node_id=1069296


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)