my $foo;
if( $baz ) {
$foo = $bar;
}
Or
my $foo;
$foo = $bar if $baz;
Of course, if you're setting $foo, then presumably your gonna use it at some point later. And unless your enamoured with testing every variable for undef prior to using it, then in most cases there is a sensible default that it can be initialised to. In which case:
my $foo = 0;
$foo = $bar if $baz;
Of course, that can be done "long hand" also if that's you preference.
And that's the point. Using this particular flaw in the Perl semantics as a justifiction for a style preference is disingenuous.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|