use v5.10.0; use warnings; @records=('nil','one','two'); $records= 50; say $records[1]; #prints the string one say $$records; # error, because $records doesn't point anywhere say $$records[0]; #still error, because $records doesn't point anywhere #you are not accessing @records here at all $records= \@records; #now $records is a reference to the array @records, but we could have #used a different variable name as well, for example $x say $$records[1]; #prints 'one', because $records points to @records $records= \$records[1]; say $$records; #prints 'one', because $records points to $records[1] $a= \$records[1]; $b= \$records[2]; #this is how sort prepares the variables $a and $b if it wants to comp +are those two records say $$a,$$b; #prints 'onetwo'
In reply to Re: Parse variables
by jethro
in thread Parse variables
by velocitymodel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |