Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: eval point in hash ref

by LanX (Chancellor)
on May 22, 2013 at 10:10 UTC ( #1034712=note: print w/ replies, xml ) Need Help??

in reply to eval point in hash ref

to eval commandline arguments is always prone to code injection

you might wanna use a simple recursion:

DB<119> sub dive { my $val=shift; $val = $val->{$_} for @_; return $val; } DB<120> $nethist => { "seek" => { messages => 42 } } DB<121> dive ($nethist) => { "seek" => { messages => 42 } } DB<122> dive ($nethist,"seek","messages") => 42 DB<123> dive ($nethist,"seek") => { messages => 42 }

Cheers Rolf

( addicted to the Perl Programming Language)

Comment on Re: eval point in hash ref
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2015-12-01 07:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (795 votes), past polls