You have to understand that Perl will return the last evalution from a sub if you are not explicit. So start being explicit!sub testUnless { my $v = 'Navidson'; unless ( $v ) { return undef; } else { return $v; } } sub testIfNot { my $v = 'Holloway'; if (!$v) { return undef; } else { return $v; } }
In reply to Re^3: unless versus if ( ! ) inside a subroutine
by Anonymous Monk
in thread unless versus if ( ! ) inside a subroutine
by Wheeler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |