"I'm confused, I thought this would work ..."
Using -MO=Deparse,-p will show you how Perl parses the code and why it doesn't work:
$ perl -MO=Deparse,-p -e 'sub ff($$){ qq{@_} } my %f = ( 12 => ff 1,2, + 34 => ff 3,4 );' Too many arguments for main::ff at -e line 1, near "4 )" -e had compilation errors. sub ff ($$) { "@_"; } (my(%f) = (12, &ff(1, 2, 34, ff(3, 4))));
On the last line of the output, you'll see &ff(1, 2, 34, ff(3, 4)) has 4 arguments - your prototype specifies 2.
-- Ken
In reply to Re: prototypes parens/parenthesis hash initialization/declaration / Too many arguments for / $$
by kcott
in thread prototypes parens/parenthesis hash initialization/declaration / Too many arguments for / $$
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |