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] };

-sauoq
"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 columns.so 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!