Smylers wrote:

sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c');

There is nothing in the signature of the key-extractor to suggest that
all the keys are numbers, but as it turns out they all are.

Are they? I'd been presuming that pair keys would always be strings

Nope.


> and that the C<< => >> operator would
automatically quote a preceding word, stringifying it (as in Perl 5).

Yes. But numbers aren't "words". C<< => >> will continue to autostringify *identifiers*, as in Perl 6, and those keys aren't identifiers.


Of course, if you used the pairs to populate a hash, the *hash* will convert the non-stringific pair keys to stringific hash keys (unless the hash is defined to take non-string keys).

Damian

Reply via email to