From c4eaadf848656f062aeb26b281a7e3767de81c39 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 5 Jan 2011 21:16:12 -0500 Subject: [PATCH] playing with hashes --- cli/hash_variables.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cli/hash_variables.pl diff --git a/cli/hash_variables.pl b/cli/hash_variables.pl new file mode 100644 index 0000000..32241c0 --- /dev/null +++ b/cli/hash_variables.pl @@ -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__