Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Basic Array Question

by saberworks (Curate)
on May 10, 2006 at 17:53 UTC ( [id://548526]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Basic Array Question
in thread Basic Array Question

The % tells perl that it is a hash (not a regular array, @, or a scalar, $). In perl, %var is different than $var is different than @var. So you can have all three if you want.

"my" declares a lexical scope. You should really read up on "use strict" "use warnings" and scoping. There are tons of articles on the web and on this site.

In regards to this specific use of "my" - it makes the two variables visible to only the inside of said while loop. If you have on "strict" and "warnings" and you try to print $page_title AFTER the end of the while loop, you will get an error, because the variable has gone out of scope.

It's not like PHP where you can make a variable inside a huge nested loop/function and have it visible outside of said loop or function.

Log In?
Username:
Password:

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

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

    No recent polls found