29 lines
457 B
Perl
29 lines
457 B
Perl
|
#!C:/Perl/Bin
|
||
|
|
||
|
%animals = (H=> 'h', S=> 's', G=> 'g');
|
||
|
|
||
|
print "$animals{'S'} \n\n";
|
||
|
|
||
|
foreach $creature(keys %animals)
|
||
|
{
|
||
|
print "$creature \n";
|
||
|
}
|
||
|
|
||
|
print "\n\ndeleting...\n\n";
|
||
|
|
||
|
delete($animals{Shark});
|
||
|
|
||
|
foreach $creature(keys %animals)
|
||
|
{
|
||
|
print "$creature \n";
|
||
|
}
|
||
|
|
||
|
print "\n\n'emptying' the hash ...\n\n";
|
||
|
|
||
|
%animals=();
|
||
|
print "Displaying empty hash ...\n\n";
|
||
|
|
||
|
foreach $creature(keys %animals)
|
||
|
{
|
||
|
print "$creature \n";
|
||
|
}
|