#!/usr/bin/perl print "Type 'exit' at any time to end this program\n"; while(1) { print "Please enter your first name\n"; chomp ($fname =); exit if $fname eq 'exit'; { last; } print "Please enter your last name\n"; chomp ($lname =); exit if $lname eq 'exit'; { last; } print "Please enter a password\n"; chomp ($password =); exit if $password eq 'exit'; { last; } print "Please enter 'done' or hit enter.\n"; chomp ($ending =); exit if $ending eq 'exit'; if ($ending eq ' ' or 'done') { last; } } my $username = "$lname, $fname"; %name_hash; $name_hash{$username} = $password; print "To search for a user please type in a name and hit enter.\n"; while() { chomp; exit if $_ eq 'exit'; foreach my $key (keys %name_hash) { if ($key =~ m/$_/i) { print "The username is $username and the password is $password, please enter another name to search\n"; } else { print "I'm sorry, there is no one here by that name, please try another name or type exit to end.\n"; } } }