Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Perl/Basics/Variables and Data Types/References/Hash"
From NetSec
AlizaLorenzo (Talk | contribs) (Created page with "A hash reference is a scalar created using the '''\ '''operator as follows: {{code|text=<source lang="perl"> my %user; $user{'name'} = "hatter"; $user{'network'} = "irc.blackh...") |
Chantal21I (Talk | contribs) |
(No difference)
|
Latest revision as of 01:56, 19 July 2012
A hash reference is a scalar created using the \ operator as follows:
my %user; $user{'name'} = "hatter"; $user{'network'} = "irc.blackhatacademy.org"; my $hashref = \%user; |
Once you've created a hashref (hash reference) you must use pointers to access a key:
print $user->{'name'} . "\n"; print $user->{'network'} . "\n"; |