in reply to Re: about arrays...
in thread about arrays...

what do u mean by current block?
I understand "my" is used for local variable.
so is "our" a global variable??

Replies are listed 'Best First'.
Re: Re: Re: about arrays...
by davorg (Chancellor) on Sep 27, 2001 at 14:27 UTC
    what do u mean by current block?

    A block is a set of statements that are contained between a pair of braces. Blocks can be associated with subroutines, loops, conditionals and a number of other Perl constructs. There is also an implicit block around all of the code in a file.

    our (like my) is lexically scoped, this means that its effects are only felt until the end of the innermost enclosing block.

    I understand "my" is used for local variable.
    so is "our" a global variable??

    Pretty much. It exposes package variables within a given block. The differences between package and lexical variables and the subtle differences between my, local and our can get a little complex. I recommend you read the section on "Scoped Variable Declarations" that starts on p130 of the 3rd edition of the Camel.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you don't talk about Perl club."