in reply to Re^2: Hashes and Memory
in thread Hashes and Memory

Actually, I understand it.

My question is how can I put the coordinates in @c if the hash has not been dereferenced? or am I doing (and thinking) about this all wrong?

Replies are listed 'Best First'.
Re^4: Hashes and Memory
by Kc12349 (Monk) on Sep 08, 2011 at 18:13 UTC

    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};
Re^4: Hashes and Memory
by RichardK (Parson) on Sep 09, 2011 at 09:37 UTC

    Have a look at perlreftut for the tutorial on references. That should tell you everything you need to know :)

Re^4: Hashes and Memory
by Jeri (Scribe) on Sep 09, 2011 at 15:46 UTC
    Got everything working! Thanks Everyone!