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; } }