Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: eval and return values

by AnomalousMonk (Archbishop)
on Jan 14, 2009 at 20:16 UTC ( [id://736362]=note: print w/replies, xml ) Need Help??


in reply to Re: eval and return values
in thread eval and return values

... since $foo is lexically re-declared in the assignment within the eval block (something that strictures would have warned you about).
No, that's kosher with warnings and strictures:
>perl -wMstrict -le "sub S { return 'Something' } my $foo = 'bar'; eval { my $foo = S() }; die $@ if $@; print qq{after eval: $foo}; " after eval: bar

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://736362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-26 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found