Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: what is the meaning of ();

by martin (Friar)
on Jul 25, 2008 at 23:23 UTC ( #700251=note: print w/ replies, xml ) Need Help??

in reply to what is the meaning of ();

The array @incdirs is defined as a lexically scoped variable and initialized to be empty. The empty pair of parentheses mean an empty list here. Lexically scoped means this variable is visible only in the block where it is defined.

Comment on Re: what is the meaning of ();
Re^2: what is the meaning of ();
by Anonymous Monk on Jul 25, 2008 at 23:34 UTC
    Thanks Martin!

      Note that, as runrig implied, the = () is redundant. Arrays and hashes start out life empty - there is no need to explicitly empty them. Scalars on the other hand start out with the value undef. It is common to declare and initialise scalars at the same time and to do so immediately before the scalar's value is first used where possible (to reduce scope of the variable to a minimum).

      Perl reduces RSI - it saves typing

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://700251]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-04-25 12:58 GMT
Find Nodes?
    Voting Booth?

    Who makes your decisions?

    Results (477 votes), past polls