my %h = ();
foreach(@_) {
$h{something} = $_; # changes the %h above every time
push @something, \%h; # puts the %h into @something multiple times...
}
####
my %h = ();
foreach(@_) {
$h{something} = $_; # changes the %h above every time
push @something, {%h}; # copies the accumulated changes into @something
}
####
foreach( @_ ) {
my %new_hash = (something => $_ ); # make a new hash
push @something, \%new_hash; # push it onto the stack
}
####
foreach(@_) {
push @something, { something => $_ }; # make a new hash and push it onto @something! Magic!
}