not either, because the scope of $x is confined to the do block:
use strict; use warnings; sub f{0} sub g{1} if (do {my $x = f(); $x and g($x)}) { print "cheerful: $x\n"; } __END__ Global symbol "$x" requires explicit package name at scope.pl line 6.
In reply to Re^2: scope of my $x in if statements
by shmem
in thread scope of my $x in if statements
by perl5ever
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |