I think there's some confusion with a few things (references, adding elements to arrays, etc). One thing that might be helpful is using Data::Dumper for debugging. Anyway, here's how I would do it:
sub parseIntoArraySolaris { # this is what we'll return after we parse my @rows; foreach my $line(@_){ # here's a temporary array for each column's value # as we split it, we divide all the numbered # values by 1024 my @cols = map {m/^[\d.-]+$/ ? $_ / 1024 : $_} (split(/\s+/,$line))[0..5]; # just for debugging I'm assuming # see note below about using Data::Dumper print "$_\n" for(@cols); # add our parsed data for this line onto @rows # this is more idiomatic than how you were doing it # with the $arrayCount++ thing push(@rows,\@cols); } # now return all the data return @rows; } sub sorter { # this isn't very efficient for large arrays but # we're probably never doing very large data sets # for this problem my @rows = @_; # you might want to use Data::Dumper to do debugging # you just do a print "before sort: ".Dumper \@rows # and it'll give you a very nice dump of the data # structure print "before sort: $rows[2]->[4]\n"; my @sorted = sort{$a->[4] cmp $b->[4]} @rows; print "Sorted by drive: $sorted[2]->[4]\n"; return @sorted; }

In reply to Re: How do I sort a Multidimensional array (not Hash)? by bpphillips
in thread How do I sort a Multidimensional array (not Hash)? by auyong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.