I'd like to note that
*foo passes
all of the following:
- $foo
- @foo
- %foo
- &foo
- the filehandle foo
\@foo passes
only @foo. In terms of maintainability, go with the reference even if it's a teeny bit slower because someone maintaining code more complex than
print_array might be confused as to which thing you really meant to pass in and use; worse, there's the possibility of accidentally using one of those variables in the subroutine and absentmindedly leaving off the
my ... for which you will get no error message!
Pass globs only when there's no other way to deal with the problem - and as of Perl 5.8 (at least), there's always a better way: references, or a filehandle in a lexical variable.