You don't need to dereference the hash ref into a standard hash variable to use it. As the previous poster said, this will make a copy of the hash instead of editing the original. You can use a hash ref just as you would a standard hash by dereferencing as needed. Below are comparisons of some common hash syntax.
Hash Hash Ref my %hash = (key=>'value'); my $hash_ref = {key=>'value'}; $hash{key} = 'mod_value'; $hash_ref->{key} = 'mod_value'; print $hash{key}; print $hash_ref->{key}; my @keys = keys %hash; my @keys = keys %{$hash_ref};
In reply to Re^4: Hashes and Memory
by Kc12349
in thread Hashes and Memory
by Jeri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |