On Mon, Feb 25, 2008 at 9:01 AM, Tim Bowden <[EMAIL PROTECTED]> wrote: > Making progress. Needed to understand hash references, and how to > de-reference them. snip
Quick cheat sheet: #make a hash reference my $ref = \%hash; my $ref = { key1 => "val1", key2 => "val2" }; my $ref = { %hash }; #access a key print $ref->{key1}; #access a slice print join("\t", @{$ref}{qw<key1 key2>}), "\n"; #get all of its keys my @keys = keys %{$ref}; #note, the {} are only necessary if $ref is a complex expression $ref can be any scalar value that hold a hash reference, so say you have an array of hash refs named @foo, you can say my @keys = keys %{$foo[0]}; to get the keys of the first element in @foo. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/