http://www.perlmonks.org?node_id=531400


in reply to "if" in a my declaration statement causes problem

Rather do this:
my $x; $x = $y if ( <some condition> );
Otherwise, post a bit more code. What do you do with $x after that?