in reply to Re: scope of my $x in if statements
in thread scope of my $x in if statements
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: scope of my $x in if statements
by ikegami (Patriarch) on May 07, 2009 at 22:23 UTC | |
by shmem (Chancellor) on May 07, 2009 at 22:35 UTC |