Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: "eval" and "my" variable weirdness

by CountZero (Bishop)
on Jun 29, 2006 at 16:01 UTC ( [id://558353]=note: print w/replies, xml ) Need Help??


in reply to "eval" and "my" variable weirdness

Forget this. I have no idea why adding a statement AFTER the eval would suddenly make it work.In my Windows ActiveState Perl 5.8.7 it works without errors, ... sort of.

The result is "thingy one is" because you have included curved brackets around the key value!. So if I change my $key = '{One}'; to my $key = 'One';, the result isbecomes "thingy one is 1->One". So clearly your eval is not doing what you think it is doing.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: "eval" and "my" variable weirdness
by splinky (Hermit) on Jun 29, 2006 at 16:08 UTC
    The curlies are intentional. In my actual app, $thingy points to a complex data structure, and $key could be something like {One}[5]{France}. That's why I'm using eval with a string instead of a block.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found