in reply to == works where it shouldn't but eq doesn't where it should
Whenever Perl tells you that two strings are not equal, odds are that Perl is propably right.
As you don't show any data, I can only guess: You have a list of names in @ops, and you read in another name, put it into the variable $who, and now try to check whether $who is a member of @ops. Then, it is likely that whitespace in one of the fields is tripping you.
Make sure you print your data before and after, and look out for whitespace:
foreach $member (@ops) { print "Comparing member '$member' against '$who'\n"; if ($member eq $who) { $op = 1; last; }; };
Coincidentially, you might later on move to a more perlish construct:
$op = grep { $_ eq $who } @ops ? 1 : 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: == works where it shouldn't but eq doesn't where it should
by wolv (Pilgrim) on Jan 16, 2006 at 20:51 UTC |