in reply to references - proper use of infix (arrow) and deprecated hash references
Edited: Also just noted that the values of your hash are array references, so the print line should be:# This is a hash: my %hash = ( 1 => 'one', 2 => 'two', ); # This is a hash ref: my $hashref = { 1 => 'one', 2 => 'two', }; # This is a hash ref of the hash above: my $hashref2 = \%hash; # Get a hash value: print "Hash: " . $hash{1} . "\n"; # Get a hashref value: print "Hash ref: " . $hashref->{1} . "\n";
print $_, "\t", $hash{$_}->[1], "\t", $hash{$_}->[2], "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: references - proper use of infix (arrow) and deprecated hash references
by ic23oluk (Sexton) on Jul 18, 2017 at 09:26 UTC |