Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: adding value to hash

by shmem (Chancellor)
on Sep 05, 2019 at 13:17 UTC ( [id://11105659]=note: print w/replies, xml ) Need Help??


in reply to adding value to hash

and this works

No, this not works:

my $data = {key => "THIS: "}; my $val = "HI THIS WORKS"; $data{key} .= $val; print "$data{key}"; __END__ HI THIS WORKS

Why? cuz $data (SCALAR, may hold an anonymous hash) and %data (HASH) are different variables.

Read the perldata manual page. Seriously:

Read perldata.

update:

Reading perldata is not a waste of time. It saves you a lot of puzzling and doubts for time to come. Not reading it in turn wastes your and our time.

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-18 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found