http://www.perlmonks.org?node_id=21829


in reply to Weird array printing/passing to subroutine problem

I'm surprised no-one has suggested it yet, but you can use prototyping to force things to happen the way you want:
sub my_sub (\@$) { my $array = shift; my $scalar = shift; # $array is a reference to the array # $scalar is the next argument } my_sub @array, "scalar";
Perl will automagically change @array into a reference for you. See perlsub for more information about prototyping.

Andrew.