lecture
in color
%foo, the reference
\%foo points to the cloud.
@bar, the reference
\@bar points to it.
{...} points to a cloud.
[...] points to a box.
$a->{'hi'}='ho' means:
$a points to.
$a->{'cat'}->{'dog'}='horse' would change this to:
$a->{'hoe'}->[2]='hello'
$foo->{'bar'}={'a'=>[0,1,2]}

delete $foo->{'bar'}, we have:

$h = $foo->{'bar'}; delete $h doesn't work (or even make sense,
because the value $h might be in two or more hashes)!
my $tuples = [['a','b',10],['a','c',20],['d','b',5]];
foreach my $t (@$tuples) {
$edges->{$t->[0]}->{$t->[1]}=$t->[2];
}
delete $edges->{'a'}->{'b'};
delete $edges->{'a'} if %{$edges->{'a'}} == 0;




my $tuples = [['a','b',10],['a','c',20],['d','b',5]];
foreach my $t (@$tuples) {
$edges->{$t->[0]}->{$t->[1]}=$t;
}
The previous code just made an equivalent hash.
This code instead points the hash at the elements,
creating aliases:

$foo->{'a'}->{'b'} and
$tuples->[0] refer to exactly the same location.
my $tuples = [['a','b',10],['a','c',20],['d','b',5]];
foreach my $t (@$tuples) {
$forward->{$t->[0]}->{$t->[1]}=$t;
$backward->{$t->[1]}->{$t->[0]}=$t;
}
This produces:

lecture
in color