Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Generation of Array of hashes by reading a file

by choroba (Cardinal)
on Jan 04, 2018 at 23:21 UTC ( [id://1206723]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Generation of Array of hashes by reading a file
in thread Generation of Array of hashes by reading a file

$rec is not a hash, it's a hash reference. When you change the referenced hash, all references pointing to it see the new value.

my $hash_ref = {}; push my @arr, $hash_ref; $hash_ref->{key} = 'value'; print $arr[0]{key}; # value

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^4: Generation of Array of hashes by reading a file
by pr33 (Scribe) on Jan 05, 2018 at 00:00 UTC

    Thanks Choroba. That cleared my confusion around this.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-24 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found