"Exiting eval via next" [perl v5.14]

Chisel chisel at chizography.net
Fri Nov 4 16:36:01 GMT 2011


Why is this considered 'bad'?

There's some confusion over whether or not this is new, or has just surface
because we've started using

 use warnings FATAL => 'all';

in some modules at $employer. (I suspect it's been warning for some time
and we've never noticed.)


$ perl -M5.14.0 -wle 'for my $i (qw/foo/) { eval { next; $i.=q{} }; } say
"done"'
Exiting eval via next at -e line 1.
done

perl -M5.14.0 -wle 'for my $i (qw/foo/) { eval { next; }; } say "done"'
Exiting eval via next at -e line 1.
done

# why no error?!
$ perl -M5.14.0 -wle 'for my $i (qw/foo/) { eval { $i.=q{}; next; }; } say
"done"'
done


What's the 'correct' way to exit the for loop?

-- 
Chisel
e: chisel at chizography.net
w: http://chizography.net


More information about the london.pm mailing list