Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: sorting scientific numbers

by trammell (Priest)
on Jun 08, 2005 at 19:11 UTC ( [id://464800]=note: print w/replies, xml ) Need Help??


in reply to sorting scientific numbers

Here's some code that does the right thing for me:
#!perl -l $, = ' '; my @n = qw/ 1e-13 2e-14 3e-15 4e-16 /; print sort @n; print sort { $a <=> $b } @n; @n = (1e-13, 2e-14, 3e-15, 4e-16); print sort @n; print sort { $a <=> $b } @n; __END__ 1e-13 2e-14 3e-15 4e-16 4e-16 3e-15 2e-14 1e-13 1e-13 2e-14 3e-15 4e-16 4e-16 3e-15 2e-14 1e-13

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://464800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-25 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found