Virtual Dave
For When You Can't Have The Real Thing
[
start
|
index
|
login
]
start
>
perl
> simple numeric sort
simple numeric sort
Created by
dave
. Last edited by
dave
, 18 years and 186 days ago. Viewed 3,612 times. #1
[edit]
[
rdf
]
labels
attachments
Simple Numeric Sort
Wrong:
foreach $item (sort(keys(%Dictionary)))
Right:
foreach $item (sort { $a <=> $b } keys (%Dictionary))
The first example does a string sort, so in this case you can end up with sequences which look like
1 2 3 44 5
The second example returns the correct order.
no comments |
post comment
see also:
snipsnap-index
perl
dave
perl
Netscreen
Juniper
snipsnap-search
Virtual Dave
Megaplex:
Home Page
This wiki's
start
page
Send Feedback To Dave
(read this
note about local search
)
Logged in Users: (0)
… and 3 Guests.
Recently Changed
SSL Certificate Bundles
Seconds Since Epoch to Local Time
ufw
Grow A LVM Partition
Creating Users
whoami
list databases
DH Selection For IPsec VPNs
2023
2022
2019
2018
2017
2011
2010
2008
2001
2000
1999
1991
Fire Eater
Custom '77 Dodge Van
Bone Shaker
Batmobile
Fire Eater Wanted
dvr-scan
Batmobiles Wanted
2021
2020
2016
Editing:
snipsnap-help
,
Image Macro
(
Et auditum est, et idcirco ego nunc simulare
)
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.
Useful:
snipsnap-help
snipsnap-macro-help
Google
snipsnap.org
| Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt