in reply to Re: passing a variable from one subroutine to another
in thread passing a variable from one subroutine to another

It's still "global", or more accurately, "a fine upstanding resident of the symbol table". local doesn't work on lexical (declared with my) variables.

local simply hides away the existing value for the duration of the lexical scope. It's still accessable through the symbol table (as a global), but within the scope, including in any subroutines called from the scope, it has a temporarily new value. For more practical information, scope out Seven useful uses of local by a local octopus enthusiast.

There, that ought to protect you from merlyn!

  • Comment on Re: Re: passing a variable from one subroutine to another

Replies are listed 'Best First'.
Re: Re: Re: passing a variable from one subroutine to another
by jerrygarciuh (Curate) on Oct 06, 2001 at 16:20 UTC
    I really appreciate the links here, in following them I also found What's the difference between dynamic and lexical (static) scoping? Between local() and my()? to be very helpful.

    In reading the aforementioned passage in Llama (p98) again, it seems to me that adherance to the strict pragma is more of a PM thing. I get the feeling that, since merlyn addresses it briefly at Chapter 8 of Llama 2nd ed., the message of the Llama is that it is more efficacious not to worry about strict when beginning to learn perl. Comments? Trout slaps from Camel ot?
    TIA
    jg
    _____________________________________________________
    Ain't no time to hate! Barely time to wait! ~RH