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.