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

Re: [MacPerl] Any way to Tee in MacPerl?



According to Chris Nandor:
> 
> This is not really a MacPerl issue, but I need to correct some
> misinformation here.  local() variables are global.  my() variables are
> lexical (local, not local()).  A local() variable simply saves the value of
> a global variable, and restores that value to that variable when the
> dynamic scope of the local() variable exits.
> 

Well, sorry too but you've presented some misinformation now also.

>From the Perl Man pages, the LOCAL command:

	local(LIST)
			Declares the listed variables to be local to the
			enclosing block, subroutine, eval or "do".  All the
			listed elements must be legal lvalues.  This
			operator works by saving the current values of those
			variables in LIST on a hidden stack and restoring
			them upon exiting the block, subroutine or eval.
			This means that called subroutines can also
			reference the local variable, but not the global
			one.  The LIST may be assigned to if desired, which
			allows you to initialize your local variables.  (If
			no initializer is given for a particular variable,
			it is created with an undefined value.)  Commonly
			this is used to name the parameters to a subroutine.

Which means the local command only makes the variables
global to those routines which are contained with the
routine which created them.  Not global to all programs.

The rest though is accurate.  :-)  Thanks for posting!

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch