toolic's point is well taken, but that "fix" is only partial. If, at runtime, one enters 0 for the month number, we see this:
Enter the month as an integer i.e. (1=January, 2=Febuary, etc.) 0 How many days [1-31]? 31 Hi Steve, I'm looking forward to the Perl class. I just want to let you know that I won't be in class on the following +days: December 1, 2, 3, 4, 5, 6, 7, ....
So one still needs to test another element of validity in the input:
chomp(my $month = <STDIN> ); $month--; print "Invalid Month $month specified\n" unless (exists $months[$month +]); unless (exists $months[$month] && ( $month >=0 && $month <= 11 ) ){ print" Quitting. Insufficient user IQ or typing skills\n"; exit; }

And, similarly with the day_of_month entry.

Further, looking back to OP's test for cities, telling the user that only a restricted list is acceptable is fine, but if the user ignores that, and enters, say, ( Livonia || Las Vegas || Los Gatos ),that user still gets an answer (clear enough here, but perhaps not in a more complicated scenario) which refers only to Los Angeles, and thus may fail to help the (inattentive) luser understand what's wrong.

Undoubtedly outside the scope of this particular bit of homework, but worth thinking about: Checking for invalid input and providing feedback are highly desireable and designing checks with broad coverage may require a lot of thought about how the user could "screw things up."


In reply to Re^2: **HomeWork** Printing the found input from an array by ww
in thread **HomeWork** Printing the found input from an array by trenchwar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.