Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^5: Assigning value through references

by m0ve (Scribe)
on Oct 09, 2007 at 09:06 UTC ( [id://643648]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Assigning value through references
in thread Assigning value through references

i always use strict but got not no complaints as perl took it as a hash,
not a reference, but i remembered it would somehow work without arrows, like this
my $crd = ${$ref}{$key}{NAME};

Replies are listed 'Best First'.
Re^6: Assigning value through references
by naikonta (Curate) on Oct 09, 2007 at 10:06 UTC
    $ref{$key}{NAME} and ${$ref}{$key}{NAME} are two completely different things. But you can say that the latter is another form of arrow notation (the first arrow, because it's a dereference operator), so they are both a hash reference.
    my $env = \%ENV; print $env->{SHELL}; print ${$env}{SHELL}; print $env{SHELL}; # barks under strict, undefined otherwise # output: /bin/bash /bin/bash

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (9)
As of 2024-03-28 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found