Your code is not checking $onname it is checking '$onname'. No interpolation ever happens inside single 's. Change to $whop{$onname} or $whop{"$onname"}. The first one is idiomatic in this case, and the second should be reserved for cases where additional key information needs to added to the variable contents.

Update: as chromatic points out, make sure to chomp your input from the file.

As I said before, I also strongly recommend not using structures like
print <<EOF; some text EOF
unless absolutely necessary. If you use standard indentation for this code, you will mess it up. And if you are not indenting yet, get in the habit. When I see something like:
if { ... } else { ... } }
I have a hard time knowing what the second } matches.

And just to make sure, you want this code to loop through a list of new members and tell you which ones are online. You are not expecting this code to loop through who is online and tell you which ones are on the new members list. right? I ask because unless I'm just plain not seeing something, it looks designed to do the former, and not the latter.

In reply to (ichimunki) re: problem with exists by ichimunki
in thread problem with exists by tanger

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.