in reply to Re^3: Search a hash for STDIN and report findings
in thread Search a hash for STDIN and report findings

you guys probably want
if ($ending eq '\n' or 'done')

to be

if ( ($ending eq '\n') or ($ending eq 'done') )

Replies are listed 'Best First'.
Re^5: Search a hash for STDIN and report findings
by moritz (Cardinal) on Feb 07, 2008 at 21:08 UTC
    We're both idiots, toolic ;-) (no offense meant).

    '\n' would only be the case if the user entered a literal backslash followed by an n. Not very likely to be intended. Since $ending is already chomped there's no need for a newline check at all.

    if ($ending eq 'done') is just fine, I think.

      When taking out the \n the while loop keeps well...looping until 'done' is entered. Keeping it in ends the loop with a carriage return or the input.