On Mon, Aug 16, 2010 at 03:14:28PM -0400, Will Coleda wrote: > On Mon, Aug 16, 2010 at 3:03 PM, David H. Adler <d...@panix.com> wrote: > > Given the code: > > > > ? ? ? ?use v6; > > > > ? ? ? ?sub speakhash (*%hash) { > > ? ? ? ? ? ?say "%hash{}"; > > ? ? ? ?} > > > > ? ? ? ?speakhash(1, 2, 3, 4, 5, 6); > > > > I get the error: > > > > ? ? ? ?Too many positional parameters passed; got 6 but expected 0 > > ? ? ? ? ?in 'speakhash' at line 3:slurphash.p6 > > ? ? ? ? ? ?in main program body at line 7:slurphash.p6 > > > > According to the UsingPerl6 draft document, "*%hash slurps all the > > remaining unbound named arguments into a hash." > > The key here is "named" arguments; You've invoked the speakhash sub > with positional args. > > Try this: > > sub speakhash (*%hash) { > say %hash.perl; > } > > speakhash(a => 1, b => 2, c => 3, d => 4, e => 5, f => 6);
Hm. It just so happens that I tried speakhash(1 => 2, 3 => 4, 5 => 6) and that didn't work. It seems that, although one can create a hash with those pairs, you *can't* pass them as arguments. I'm not clear why. dha -- David H. Adler - <d...@panix.com> - http://www.panix.com/~dha/ i just ate a slice of key lime pie while drinking limeade scurvy can't touch me now - obnoxicant