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?

I learnt this from The Perl Black Book...

You need to review the lessons.

Your prototype means that any optional hashref supplied will be assigned to the array, and will never get assigned to the appropriate place inside the sub:

sub test($@;\%){ my( $scalar, @array, $hashref ) = @_; pp $_ for $scalar, \@array, $hashref; };; $s='fred'; @a = 1..10; %h = 1..10;; test( $s, @a, \%h );; "fred" [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, { 1 => 2, 3 => 4, 5 => 6, 7 => 8, 9 => 10 }, ] undef

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"