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

Re: Sort and push

by Bloodnok (Vicar)
on May 15, 2009 at 09:48 UTC ( #764226=note: print w/replies, xml ) Need Help??


in reply to Sort and push

As targetsmart says, you should define the nature of the sort you require.

That being said, using the default (alphbetic) sort (and assuming @datas & amp; @arr are the source & result arrays respectively), you'd use something like...

my @arr = sort @datas;
BTW, you do realise that, within the loop in your snippet, you modify the fifth element of @data and then only use the first 2 elements of said array - by pushing a concatenation of them onto the result array.

A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2023-12-09 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (38 votes). Check out past polls.

    Notices?