On Fri, 15 Jun 2001, Tim Musson wrote:

> Friday, June 15, 2001, 4:28:05 PM, you wrote:
>
> BWM> Using "my" puts the variable into a lexical scope and keeps it
> BWM> out of the global name space.
>
> What does lexical mean here?  I looked it up in a dictionary, but still
> am not sure how it applies.

A lexical scope can be a block of code enclosed in braces:

{
  my $var = 12;
  ...
}

or inside a function:

sub foo {

  my $var = shift;
  ...
}

These variables are not visible outside their scope -- they are
localized.  This also includes a file scope -- a my variable declared in a
file is not visible outside of the file.  You can create global variables
that are.

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
If you think the system is working, ask someone who's waiting for a prompt.

Reply via email to