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


in reply to subroutine help

The arguments to a subroutine are ... a list. If you "pass an array," Perl might flatten that array into a list of individual arguments. What you really want to do is to pass one argument to the subroutine, consisting of a reference to that array; an "arrayref." A reference (to anything...) is always "one thing." Be explicit about how you say this sort of thing to Perl, because Perl does try to "do what I mean (DWIM)" and is sometimes wrong. Also be sure to say use strict; use warnings; at the top of your module so that problems which might otherwise "helpfully" be ignored will be told to you.