Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: what is the meaning of ();

by martin (Pilgrim)
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2014-09-21 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls