The word was "dereference," which means "to get at the thing pointed to by the reference." If you're familiar with C, references are a lot like pointers, except that you can't do arithmetic on them; they're essentially read-only. So for instance:
my @array = qw(a b c d); # create an array print $array[2]; # prints 'c' my $arrayref = \@array; # create a reference to the array print $arrayref->[2]; # prints 'c'. The arrow is required when # getting an element of an array or hash # pointed to by a reference my @newarray = @{$arrayref}; # dereference $arrayref to get at the # array it points to, and # copy it to @newarray print $newarray[2]; # prints 'c'
Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.
In reply to Re^3: I have a perl snippet. And I need help understanding it. Can you help answer these questions.
by aaron_baugher
in thread I have a perl snippet. And I need help understanding it. Can you help answer these questions.
by Fighter2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |