use strict; sub foo { my (@args) = @_; print "$_\n" for @args; }; my @a = qw(a1 a2 a3); my @b = qw(b1 b2 b3 b4 b5); foo(1,2,3,4,5,@a,@b);