... my @sample=qw(a b c); trial(\@sample); sub trial { my ($sample) = @_; print join("\t",@$sample); }
This would assign the array reference passed to the routine to the reference $sample (a local lexical scalar variable), which you can then dereference to an array using @$sample.
In reply to Re: dereferencing array in a subroutine
by almut
in thread dereferencing array in a subroutine
by Ratna_Ranjan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |