All pastes #50174 Raw Edit

ENDLOSUNG

public text v1 · immutable
#50174 ·published 2006-04-20 16:01 UTC
rendered paste body
#!/usr/bin/perl
use strict;
use warnings;

my %hash;

$hash{'wouter'}{'total'} = 30;

# The value of this key is a hash reference...
print "$hash{'wouter'}\n";

# This prints 30:
print "$hash{'wouter'}->{'total'}\n";
# Why?
# Because the value of key wouter get's dereferenced
# Now, it finds total and it prints its value: 30.


my %hash1 = (
        wouter => 'meester',
);

my %hash2 = (
        login => 'meesterlijk',
);

my @AoH = (
        \%hash1,
        \%hash2,
);

print "${$AoH[0]}{'wouter'}\n";

my @array1 = (
        'Japie',
);

my @array2 = (
        'Jan',
);

my %HoA = (
        human => \@array1,
        reference => \@array2,
);

# Prints Japie...
print "$HoA{'human'}->[0]\n";
# Prints @array's 1 address...
print "$HoA{'human'}\n";