sub Function(\[$@%]);
This works on Windows (Perl v5.14.2 on Windows 7), and accepts all 3 kinds of arguments. Hashes, Scalars and Lists.
However, the same prototype on Linux (Perl 5.6.1 on CentOS release 4.5) gives me
Malformed prototype for main::Function: \[%@$].
On both, I am doing use 5.006.
And otherwise, the scripts are exactly identical.
That prototype didn’t exist back in 5.6.1. It’s a recent addition as it was added in 5.14. (That means it’s in all supported versions of Perl.)
You can’t pass an array or a hash to a sub, only a list of scalars. The prototype is causing the calling code to take a reference and pass that. That’s something you can do explicitly by changing
to
Prototypes are generally to be avoided anyway.