in reply to Sorting packed arays

Could you put it into a Tie::Array::Pack or Tie::Array::Packed array and just use sort?

Replies are listed 'Best First'.
Re^2: Sorting packed arays
by salva (Canon) on Dec 06, 2008 at 11:01 UTC
    Could you put it into a Tie::Array::Pack or Tie::Array::Packed array and just use sort?

    That does not work as you expect, sort unpacks the array before sorting it.

    Though, Tie::Array::Packed has a sort method that can be used for that. For instance:

    tie my @p, 'Tie::Array::Packed::Integer'; push @p, $_ for (.....); tied(@p)->sort;
    (it just calls Sort::Packed under the hood)