The_Rev has asked for the wisdom of the Perl Monks concerning the following question:
The sort routine does the job, but only looks at the first digit of each element. This works for single numbers, but my array contains 2 or more digit numbers, This is the code I'm working with;
use strict; @event_queue = ("18", "503", "103", "501", "53"); @event_queue = sort(@event_queue); foreach $_ (@event_queue){ print "$_\n"; }
This produces:
The sort should look like this:103 18 502 503 53
Any suggestions?18 53 103 502 503
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array Sort
by davis (Vicar) on Sep 10, 2002 at 11:42 UTC | |
|
Re: Array Sort
by JaWi (Hermit) on Sep 10, 2002 at 11:44 UTC | |
by The_Rev (Acolyte) on Sep 10, 2002 at 11:53 UTC | |
|
Re: Array Sort
by Anonymous Monk on Sep 10, 2002 at 16:45 UTC | |
by blakem (Monsignor) on Sep 11, 2002 at 01:44 UTC |