playing with hashes

This commit is contained in:
Dan Buch 2011-01-05 21:16:12 -05:00
parent afe4b10808
commit c4eaadf848

31
cli/hash_variables.pl Normal file
View File

@ -0,0 +1,31 @@
#!/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";
1;
__END__