i've definitely solved the repetition problem! i'm not sure i can /see/ what "next;" is doing, but it does seem to be helping! haha.

i think my confusion now is, after doing all the other steps i can, i'm still not positive how to make the final if statement work: it's meant to be, "if user inputs none of the menu options, the invalid message appears". when i had it set to "if ($choice ne 'a'...'e')" then print the error message, but it seems like it's taking the input for $name1, etc, as an invalid input, too.

} if ($choice eq 'r'){ print "Enter a male name: "; chomp (my $name3 = lc <STDIN>); if (exists $son_father{$name3}) { print "Enter a new father name: "; chomp ($newname = <STDIN>); $son_father{$name3} = {$newname}; } else { print "Sorry, couldn't find you -- try again later!"; next; } } if ($choice ne 'a', 'r', 'o', 'd', 'e') { print "Invalid choice, TRY AGAIN!\n"; } }

i'm going to try and ask my professor about this more tomorrow, but i'm wondering if i'm just missing something obvious. will it read /every/ non-$choice standin as false if i write the if statement like this? is there any way to fix that? i thought assigning each standin a different variable would keep it separate from the if statement...

i'm definitely feeling less anxious after getting some help, but i'm getting pretty delirious after working on this for seven hours, hahah. sorry for being a bit incoherent.

oh, gosh, i forgot to say thank you. that's the problem with staying up until 4am. thank you so much!


In reply to Re^2: help with user selected hash operations? by lunette
in thread help with user selected hash operations? by lunette

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.