in reply to scope of my $x in if statements

I don't think this works in Perl 5, the variable is only visible in the statement after the declaration. It works in Perl 6, though:
$ perl6 -e 'sub f { 3 }; sub g($a) { $a }; if my $x = f() and g($x) { +say "works" }' works