in reply to Re^2: Is there any difference between prototype % and @ ?
in thread Is there any difference between prototype % and @ ?
... an even number of arguments...
I will add a manual check.
What are you doing with the arguments subsumed under the % prototype? Well, right now you're probably just writing test code to check the behavior of the prototype, but in a 'real world' case, would you not assign these arguments to a hash? What else? If assigning an odd number of elements to a hash, Perl warns (if warnings are enabled) with no separate check necessary. Granted, the warning doesn't stem from the prototype checking system, but...
>perl -wMstrict -le "sub H (&%) { my ($cr, %h) = @_; $cr->(%h); } ;; H { print @_; } qw(a 1 b); " Odd number of elements in hash assignment at -e line 1. Use of uninitialized value $_[3] in print at -e line 1. a1b
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is there any difference between prototype % and @ ?
by LanX (Saint) on Feb 22, 2013 at 20:52 UTC | |
by BrowserUk (Patriarch) on Feb 22, 2013 at 21:57 UTC | |
by LanX (Saint) on Feb 22, 2013 at 22:00 UTC | |
by BrowserUk (Patriarch) on Feb 23, 2013 at 07:03 UTC | |
by AnomalousMonk (Archbishop) on Feb 23, 2013 at 15:13 UTC | |
| |
by LanX (Saint) on Feb 23, 2013 at 14:08 UTC | |
|