in reply to "if" in a my declaration statement causes problem
Rather do this:
Otherwise, post a bit more code. What do you do with $x after that?my $x; $x = $y if ( <some condition> );
In Section
Seekers of Perl Wisdom