[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Location of MAIN code relative to subroutines




Thanks for your reply Paul.

So how does the $inputfile variable escape the same fate
as the $TIME_OFFSET variable?  Given the definition of "my"
variables you provided from perlsub, wouldn't the value of
the $inputfile in the "ParseFile" sub be in question as well?

Ero Brown

-------------------------------------------------------------


>On Tue, Apr 27, 1999 at 11:41:32AM -0600, Ero Brown wrote:
>}
>} I seem to ben having a problem regarding the placement of "MAIN"
>} code relative to subroutines.
>}
>} When I execute the following script, the variable $TIME_OFFSET
>} doesn't seem to have value in the "ParseFile" subroutine.
>}
>} However, if I move the location of my "MAIN" code (or actually
>} just the code snip in "MAIN" where $TIME_OFFSET is defined) to
>} a position before my subroutines, this script appears to work
>} correctly.
>}
>} Is this a MacPerl bug, or am I missing something here?
>} I'm currently using MacPerl 5.2.0r4.
>
>You're missing something.  From perlsub (I don't remember what Shuck
>calls it):
>
>
>     Unlike dynamic variables created by the "local" operator,
>     lexical variables declared with "my" are totally hidden from
>     the outside world, including any called subroutines (even if
>     it's the same subroutine called from itself or elsewhere--
>     every call gets its own copy).
>
>$TIME_OFFSET only exists from the point you declare it to the end of
>the file.  The subroutines never see it.
>
>
>}
>} Thanks,
>}
>} Ero Brown
>}
>
>--
>Paul Schinder
>schinder@pobox.com




===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org