SORTING MATRIX IN PERL
SORTING MATRIX IN PERL
(OP)
Hi,
I have written some Perl scripts occasionally in order to facilitate my job as a CAE-engineer. Everytime I need to sort the results that I have stored in a matrix I have had to make the sorting myself i.e. using some subroutine. However, Id really, really would like to learn how to use the perl function sort. I have read about it at many places and also tried to get it working but I have never ever got it to work for me. Can anyone help me here?
Say that i have a matrix $matrix with $n rows and $m columns and that I want to sort the rows based on what is the number in the second column. How do I do this using teh Perl sort function?
I would be very grateful for any help here!
Best regards
Pierre
I have written some Perl scripts occasionally in order to facilitate my job as a CAE-engineer. Everytime I need to sort the results that I have stored in a matrix I have had to make the sorting myself i.e. using some subroutine. However, Id really, really would like to learn how to use the perl function sort. I have read about it at many places and also tried to get it working but I have never ever got it to work for me. Can anyone help me here?
Say that i have a matrix $matrix with $n rows and $m columns and that I want to sort the rows based on what is the number in the second column. How do I do this using teh Perl sort function?
I would be very grateful for any help here!
Best regards
Pierre
Live Long and Prosper !





RE: SORTING MATRIX IN PERL
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers
RE: SORTING MATRIX IN PERL
Dan - Owner
http://www.Hi-TecDesigns.com
RE: SORTING MATRIX IN PERL
If you are working in perl, make sure you comment the code - it is one of those syntax rich languages where simple statements can be written in lots of different ways - depends on what languages you have used as to how you write the code. Cobol programmers will write perl differently from C programmers.
Re: Live long and Prosper: you may have to use the spaceship operator <=>