...the unless is explicitly not going to ever evaluate because the condition is predetermined to be false.
This doesn't make much sense to me. In both cases (if and unless) the conditional has to be evaluated. It's just that when the value isn't negated, the last thing evaluated is the value as is. When you request the negated value to be tested in the conditional, the negated value is the last thing evaluated. How else would you explain that the following returns 1?
sub testUnlessNot { my $v = ''; unless ( !$v ) {}; # returns 1 }
In reply to Re^3: unless versus if ( ! ) inside a subroutine
by almut
in thread unless versus if ( ! ) inside a subroutine
by Wheeler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |