Ed wrote:
I want to sort the lines in the file by the 3rd column (Field,
Internal, CM, DocAdmin)
Since Perl doesn't really support multidimensional arrays but instead uses references, something like this should work:
sort { $$a[2] cmp $$b[2] } @array;

This is more or less like the typical
sort { $a cmp $b } @array;
I'm reading the lines into an array and converting each line to an
array so I can access the 3rd column. Once I do this I have a 2
dimensional array, but I can't de-reference the way I think it should
work. (deja vu)
Do you have references in your array or are you doing the following?
            push( @lineArray,  @_  );  <---no it's an array of arrays.
This is equivalent (although more efficient) to
@[EMAIL PROTECTED] .. $#_ + @lineArray] = @_;
which is equivalent to
splice (@lineArray, @lineArray, 0, @_);
As mentioned, that should be push (@lineArray, [EMAIL PROTECTED]) or some such.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to