Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Eval str return different from Eval block return

by demerphq (Chancellor)
on May 17, 2002 at 09:47 UTC ( #167250=note: print w/ replies, xml ) Need Help??


in reply to Re: Eval str return different from Eval block return
in thread Eval str return different from Eval block return

Which OS and Perl version Zaxo? I still get incorrect results

use strict; use warnings; sub capture {\@_}; sub readonly{ my $v=$_[0]; eval{$_[0]=$v;1} ? 0 : 1 } $\="\n"; print "No eval :",readonly(capture(5)->[0]); eval ' print "In str eval :",readonly(capture(5)->[0]); '; eval { print "In block eval :",readonly(capture(5)->[0]); }; print "Block Eval ret :",readonly(eval{capture(5)}->[0]); print "Str Eval ret :",readonly((eval'capture(5)')->[0]); print "Str Eval ret2 :",readonly(eval('capture(5)')->[0]); __END__ No eval :1 In str eval :1 In block eval :1 Block Eval ret :1 Str Eval ret :0 Str Eval ret2 :0

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.


Comment on Re: Re: Eval str return different from Eval block return
Download Code
Re: Re: Re: Eval str return different from Eval block return
by astaines (Curate) on May 17, 2002 at 11:53 UTC

    On Win NT and AS perl 5.6.1 you get

    --<br> No eval :1 In str eval :1 In block eval :1 Block Eval ret :1 Str Eval ret :0 Str Eval ret2 :0 --
    Anthony Staines

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-04-18 03:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (461 votes), past polls