more useful options | |
PerlMonks |
Re^3: Basic Array Questionby saberworks (Curate) |
on May 10, 2006 at 17:53 UTC ( [id://548526]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|