Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Array Sort

by JaWi (Hermit)
on Sep 10, 2002 at 11:44 UTC ( #196628=note: print w/replies, xml ) Need Help??


in reply to Array Sort

That's because it handles each element of your array as string. You probably want this:
... @event_queue = sort { $a <=> $b } @event_queue; ...

BTW: you don't need to explitly assign the $_ operator in the foreach loop. It is done automatically...

Greets,

-- JaWi

"A chicken is an egg's way of producing more eggs."

Replies are listed 'Best First'.
Re: Re: Array Sort
by The_Rev (Acolyte) on Sep 10, 2002 at 11:53 UTC
    That worked!

    I always learn something when I post, like the absence of $_ in a foreach loop
    Thanks Again!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-10-07 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (30 votes). Check out past polls.

    Notices?