#!/usr/bin/perl print "Excuse Generator\n\n\n"; my @myCities = ('Baltimore','Chicago','Los Angeles','New York','San Diego'); my $found=0; print "Please pick one of the following cities by entering any portion of the beginning of the city name:(@myCities)\n"; chomp(my $input_city = ); if ( $input_city =~ m/^l/i ) { print "We no longer tour the city of Angels, please try again\n"; exit; } foreach my $city ( @myCities ) { if ($city =~ /^$input_city/i ) { print "Found $city\n"; $found = 1; next; } } if ($found == 0) { print "No City found!\n"; } my %num2mon = ( "1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December" ); print "Enter the month as an integer i.e. (1=January, 2=Febuary, etc.)\n"; chomp($month = ); if (exists $num2mon{$month}) { #exists; } else { print "Invalid Month $month specified\n"; } print "How many days [1-31]?\n"; chomp(my $num_days = ); my $days = join( ", ", 1 .. $num_days ),; @myArray = ( "\nHi Steve, \n\n", "I'm looking forward to the Perl class. \n", "I just want to let you know that I won't be in class on the following days:\n\n", "\ $num2mon{$month} $days\n\n", "I'm touring $city with my dance band, Liquid Blue!\n\n", "Thanks,\n", "Scott Stephens\n\n" ); print @myArray;