in reply to Function that accepts both hashes/arrays and hashrefs/arreyrefs

First off, if you're asking a question like this, don't use prototypes. They're not required in Perl and they probably don't do what you're expecting - a Perl prototype isn't the same thing as a C prototype. See the example at the end of the perlsub section on prototypes and/or The purpose of prototypes in perl subroutines for more details.

Now, on to your actual question...

You can use ref to test whether your first argument is a scalar, a hashref, or an array ref to get some multi-style support, but, if the first argument is a scalar, you have no way to determine whether it's the first element of an array or the first key in a hash, since arrays and hashes are both passed in as plain lists. (I suppose you could test the size of @_, which would tell you it's an array if there are an odd number of elements, but you'd still just be taking a shot in the dark if it's even.)