in reply to Re: Duh. 'my' scope in if else blocks.
in thread Duh. 'my' scope in if else blocks.
if behaves similar to for in this respect.if ( my $t = shift ) { $t =~ s/change_something/to_something_else/; } print "$t\n"; # out of scope here
Somewhat surprisingly then, this does not work:
print $t if (my $t = shift);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Duh. 'my' scope in if else blocks.
by ikegami (Patriarch) on Dec 11, 2007 at 19:57 UTC | |
Re^3: Duh. 'my' scope in if else blocks.
by doom (Deacon) on Dec 11, 2007 at 19:14 UTC |