[JOB] Perl Software Developer and Database programmer

Andy Armstrong andy at hexten.net
Wed Feb 22 11:10:58 GMT 2006


On 22 Feb 2006, at 11:00, Peter Hickman wrote:
> A little worrisome this, I couldn't tell you the difference between
> local and my, I could probably muddle through our. I do know closures
> but what's a stash? I would like to think that I am at least competent
> after all these years but it sounds like I would probably fail.

local works almost exactly the same as LOCAL in BBC Basic :)

(like that helps anyone)

Conceptually local stashes the old value of a variable on a stack and  
arranges to restore it's value at the end of the block while my  
declares a new variable in the current scope. Dynamically scoped  
versus lexically scoped.

So, for example

local $/;

takes $/ and saves it somewhere for later while

my $/;

says Can't use global $/ in "my"

-- 
Andy Armstrong, hexten.net



More information about the london.pm mailing list