P is for Practical | |
PerlMonks |
Re: Array of variablesby Jenda (Abbot) |
on May 29, 2013 at 09:37 UTC ( [id://1035798]=note: print w/replies, xml ) | Need Help?? |
There are two places in Perl that may confuse people to think arrays contain variables. While @array = ($one, $two, $three); does make copies of the values of those variables for my $x ($one, $two, $three) { doesn't make copies, but rather aliases $x to the variables one at a time:
So arrays contain values, but for loops through the "things" specified in the list you specify and if that "thing" is a variable, you can change it. There is an exception though. The @_ array used for parameters to subroutine calls:
Jenda
In Section
Seekers of Perl Wisdom
|
|