in reply to Re: What's the better Perl style? Define parameters or not?
in thread What's the better Perl style? Define parameters or not?

You are also wrong about \%. \% means the sub requires a hash, not a hashref.

>perl -le"sub f(\%) { print $_[0] } f(\%h)" Type of arg 1 to main::f must be hash (not reference constructor) at - +e line 1, at end of line Execution of -e aborted due to compilation errors. >perl -le"sub f(\%) { print $_[0] } f(%h)" HASH(0x238be4)

A hashref is what the sub receives.

There is no prototype that will enforce what you desire (a scalar, an array and an optional hashref). Prototypes aren't good at validation.