Blob
1 #!/usr/bin/perl3 #Write a program that will ask the user for a given name and report the4 #corresponding family name. Use the names of people you know, or (if you spend5 #so much time on the computer that you don't know any actual people) use the6 #following table:7 #8 #Input Output9 #==========================10 #fred flintstone11 #barney rubble12 #wilma flintstone14 use v5.10;15 use warnings;16 use strict;17 use utf8;19 my %names = (20 fred => "flintstone",21 barney => "rubble",22 wilma => "flintstone",23 );24 my $name;25 print "Type a name: ";26 while (defined(chomp($name = <>))) {27 print $name." ". $names{$name}."\n";28 print "Type a name: ";29 $name = undef;30 }