Assignment in an if is fine if you're doing:
if ( my $var = something() ) { # use $var here }
(Ditto while.)
But if $var has a wider scope, it's probably a bad idea.
In reply to Re^3: scope of variables in a sub
by tobyink
in thread scope of variables in a sub
by frontrange
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |