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

Sometimes I'll write a function that accepts either a hash, hashref or single scalar. The hash and hashref are for the long-form  foo( name => 'bar', hat => 'funny') and  foo( { name => 'baz', hat => 'hard' } ) forms and the single scalar is for the short lazy form  foo('antelope').

I check if the length of @_ is greater than 1, I treat it as a hash. If the length of @_ is 1, I use ref to determine if it's a hash ref or a scalar.

Notice I'm not trying to handle arrays and array refs. While you can tell the difference between an array ref and a hash ref, you can't really tell the difference between an array and a hash, unless you have other weird constrains, like your arrays always have an odd number of elements or your hashes allways have the same keys etc... etc...

So, to sum up, unless you know how to tell the difference between a hash and an array in your context, you can't get there from here.

--Pileofrogs