2011-01-06 02:16:12 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
|
|
|
|
my %petsounds = (
|
|
|
|
"cat" => "meow",
|
|
|
|
"dog" => "woof",
|
|
|
|
"snake" => "hiss"
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
print "The cat goes " . $petsounds{"cat"} . ".\n";
|
|
|
|
|
|
|
|
|
|
|
|
$petsounds{"mouse"} = "squeak!";
|
|
|
|
$petsounds{"dog"} = "arf!";
|
|
|
|
|
|
|
|
|
|
|
|
delete($petsounds{"cat"});
|
|
|
|
|
|
|
|
|
|
|
|
print "The mouse goes " . $petsounds{"mouse"} . ".\n";
|
|
|
|
|
|
|
|
|
|
|
|
print Dumper(\%petsounds) . "\n";
|
|
|
|
|
|
|
|
|
2011-01-06 02:21:00 +00:00
|
|
|
my %a = ();
|
|
|
|
$a{1}{"a"}{"A"} = "FIRST";
|
|
|
|
$a{1}{"c"}{"B"} = "THIRD";
|
|
|
|
$a{1}{"b"}{"C"} = "SECOND";
|
|
|
|
|
|
|
|
foreach my $k1 (sort keys %a) {
|
|
|
|
foreach my $k2 (sort keys %{$a{$k1}}) {
|
|
|
|
foreach my $k3 (sort keys %{$a{$k1}{$k2}}) {
|
|
|
|
print "$k1\t$k2\t$k3\t$a{$k1}{$k2}{$k3}\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print Dumper(\%a);
|
|
|
|
|
|
|
|
|
2011-01-06 02:16:12 +00:00
|
|
|
1;
|
|
|
|
__END__
|