in reply to Re^3: scope of my $x in if statementsin thread scope of my $x in if statements
That's only true if g() has no side-effects and no performance penalty.