Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thank you in advance.use strict; use warnings; my %hash = ( 'asdf.com' => 'asdf', 'abc.123.com' => '123', 'just.me.com' => 'me', 'just.you.com' => 'you', 'new.domain.com' => 'new', 'newest.domain.com' => 'newest' ); print "\nPossibly domain names: \n\n"; foreach my $key (keys %hash) { print " $key\n"; } print "\nWhat is the domain name of this server? \n"; my $selection = <>; chomp $selection; foreach my $key (keys %hash) { if ($key eq $selection) { print "\n"; }else{ print "\nThe domain you entered is not on the list above. Now + exiting script.\n"; exit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is this code not printing hash key?
by Athanasius (Archbishop) on Apr 29, 2014 at 13:49 UTC | |
|
Re: Why is this code not printing hash key?
by NetWallah (Canon) on Apr 29, 2014 at 13:54 UTC | |
|
Re: Why is this code not printing hash key?
by bigj (Monk) on Apr 29, 2014 at 13:52 UTC |