#!/usr/bin/perl #update: some problems with the month array in my code belo w (I was thinking the index starts at 1 not 0, newbie mistake. See discussion. use strict; use warnings; 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 ) { $found = $city; print "Found $found\n"; next; } } unless ($found) { print "No City found!\n"; exit; } my @months = qw(January February March April May June July August September October November December); print "Enter the month as an integer i.e. (1=January, 2=Febuary, etc.)\n"; chomp(my $month = ); print "Invalid Month $month specified\n" unless (exists $months[$month]); print "How many days [1-31]?\n"; chomp(my $num_days = ); #problems here, see discussion my $days = join( ", ", 1 .. $num_days ),; my @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", "\ $months[$month] $days\n\n", "I'm touring $found with my dance band, Liquid Blue!\n\n", "Thanks,\n", "Scott Stephens\n\n" ); print @myArray;