P is for Practical | |
PerlMonks |
Re^5: beginner - ordering tuplesby BrowserUk (Patriarch) |
on Nov 13, 2010 at 14:24 UTC ( [id://871234]=note: print w/replies, xml ) | Need Help?? |
why has it put some of the output in single quotes: The input array is initialised with strings. Left unmodified, all the values would be output in quotes. During the sort process, any values that are compared as numbers using <=>, will first be converted, internally, to their (binary) numeric representation. But as the first & last pairs in your example have unique first elements (1 & 12), there is never any need to compare their second elements, hence they are never converted to numeric representation, and so are output as strings. 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.
In Section
Seekers of Perl Wisdom
|
|