Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: local and global variable?

by ricDeez (Scribe)
on Aug 22, 2011 at 18:02 UTC ( [id://921705]=note: print w/replies, xml ) Need Help??


in reply to local and global variable?

Being new to Perl, one of the things that you want to avoid is getting mixed up with your scalars and arrays, which is easy to do when you use similar names for your scalars and arrays (i.e. $species and @species). Whilst, it is true that this word uses the same form for its singular and plural forms, a more apt name may be $sp for you scalar variable (i.e. singular abbreviation). It is not considered good form to name variables as you have done here.

You may also want to read up on variable scoping rules in Perl to understand why my @tree is not accessible outside the for loop.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-23 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found