http://qs321.pair.com?node_id=748866


in reply to passing an array and some scalars to a subroutne

You can also shift the args.

Also, since the arguments are passed as a list, you could start considering passing references to the arrays and deref them in the sub. That way you can pass other args after the first array, or multiple arrays (that would otherwise be considered a single one).

use strict; use warnings; my $arg1 = "abc"; my @arg2 = (1, 2, 3, 4); show_args($arg1, \@arg2); sub show_args { my $arg1 = shift; my $arg2 = shift; my @lines = @{$arg2}; print @lines; }