Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Eval/package question

by shmem (Chancellor)
on Jan 21, 2020 at 14:26 UTC ( #11111682=note: print w/replies, xml ) Need Help??


in reply to Eval/package question

What is wrong? Why does the eval somehow access my hash, but does not add the value? Is it something obvious and I'm just blind today?

It does access the hash and puts this slots value on the LHS, not the hash slot accessing expression. So yes, you're being blind :-)
Try

eval ("\$items{3}{Value} = 2;"); # also: eval ('$items{3}{Value} = 2;');

Had you checked $@ after the eval, you would have seen that it contains

syntax error at (eval 2) line 1, near "="

since the LHS of the assignment is empty.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2020-06-05 01:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?