in reply to passing array as an argument

When you need to pass arrays or hashes to a subroutine, learn to pass them as references - it will save you a lot of headaches. As others have already said, the parameter list gets flattened out into a list of scalars, but if all you pass to the subroutine is scalars (references are scalars), then you are all right.
#!/usr/local/bin/perl use strict; my @ar; sub test_args{ my ($ar_arrayref, $t) = @_; print "t = $t\n"; print "ar = @$ar_arrayref\n"; print "element 0 of array \@ar = $ar_arrayref->[0]\n"; ### ### or create a new array from the reference ### my @test_ar = @$ar_arrayref; print "element 0 of array \@test_ar = $test_ar[0]\n"; } push (@ar,"one"); push (@ar,"two"); test_args(\@ar,"three"); ----------------------------- output: t = three ar = one two element 0 of array @ar = one element 0 of array @test_ar = one
HTH.