note
QM
The Perlmonks collective seems to be having a few problems today. Left off the closing paren:
<code>
foreach (sort { $hash{$a} <=> $hash{$b} || $a cmp
+$b } (keys %hash) )
</code>
Or, alternatively, there's an extra one before "keys".
( <code>keys %hash</code> doesn't need parens for sort -- the parens are only needed for <code>foreach</code>.)
<p>
And I avoid the use of <code>||</code> in these cases, because of precedence worries. Use <code>or</code>, and parens if needed, and eliminate one more worry.
<p>
<b>Update:</b> Changed value comparison to numeric, per [greywolf].
<div class="pmsig"><div class="pmsig-294463">
<p>-QM<br />
--<br />
Quantum Mechanics: The dreams stuff is made of
</div></div>
537849
537851