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

Dave Hodgkinson davehodg at gmail.com
Fri Nov 4 21:49:49 GMT 2011


On 4 Nov 2011, at 20:16, Graham Barr wrote:

> 
> On Nov 4, 2011, at 11:36 , Chisel wrote:
>> 
>> # why no error?!
>> $ perl -M5.14.0 -wle 'for my $i (qw/foo/) { eval { $i.=q{}; next; }; } say
>> "done"'
>> done
> 
> Because the next never happens, check $@ you will see
> 
> Modification of a read-only value attempted

A more enlightening error would be nice.

I find myself tempted to next in the $@ check. What's a good 
idiom for failing out of an eval then?


More information about the london.pm mailing list