From: Brian Candler Date: 2003-07-18T02:40:09+09:00 Subject: Re: What's the point? On Fri, Jul 18, 2003 at 02:17:42AM +0900, Phil Tomson wrote: > As to your other question about "why?" - Sometimes I used to do this in > Perl to localize some functionality within a method (..errr, function or > subroutine in Perl parlance). Usually this was in a sort of refactoring > stage where I'd look at my sub and find that I had some duplicated code in > it that I could collect into another sub-sub. Beware, thar be demons. sub foo { my $x = $_[0]; sub bar { print "x is $x\n"; } bar(); } foo("one"); foo("two"); Prints: x is one x is one To be fair, if you run perl with -w, you get a cryptic warning: Variable "$x" will not stay shared at x.pl line 4. Regards, Brian.