Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: eval and return values

by AnomalousMonk (Archbishop)
on Jan 14, 2009 at 20:16 UTC ( #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? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-06-09 10:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (35 votes). Check out past polls.

    Notices?