in reply to Can If-then conditions do ($a = $b = $c) type expressions?
$a == $b is 1, which is obviously not equal to 5. As was recommended, grep's probably the way to go. Or
$h{$_}++ for( $a, $b, $c ); if( $h{$a} == 3 ) { ... }
Update: Just as a clarification, that hash trick will only work for things that stringify to the same thing. So for example if $b = "5 ", it wouldn't work (even though 5 == "5 " is true).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Can If-then conditions do ($a = $b = $c) type expressions?
by snafu (Chaplain) on Apr 25, 2002 at 17:04 UTC | |
by dsb (Chaplain) on Apr 25, 2002 at 17:15 UTC | |
by Sidhekin (Priest) on Apr 25, 2002 at 20:28 UTC |