Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: sorting the column of array element

by sauoq (Abbot)
on May 24, 2012 at 00:11 UTC ( #972132=note: print w/replies, xml ) Need Help??

in reply to sorting the column of array element

Hi, I am trying to sort the zeroth array element

By this do you mean that your $array[0] is a reference to an array?

If so, you want something like

@sort = sort {$b <=> $a} @{ $array[0] };

"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re^2: sorting the column of array element
by anonym (Acolyte) on May 24, 2012 at 00:14 UTC

    Hey Thanks.. Yes $array[0] is one column of a tab delimited file having three i wanna sort on the first column Thanks

      Ummmmm..... it seems to me that either your answer, "yes," to the question whether @array[0] 'is a reference to an array?'
      • is inaccurate (eg, 'wrong')
             . ... or else
      • @array[0] is something other than the simple content of 'one column of a tab delimited file having three columns' (where the 'simple content' is something sortable -- either numericly or alphabetically -- without further specification of the criteria for sorting).

      Which is it?

      Update: Added quoted content in second bullet, for clarity and closing paren for correctness. Duh!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2016-09-28 04:35 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (519 votes). Check out past polls.