Re: sort in a file using Perl

2001-09-06 Thread Randal L. Schwartz
> "+Brian" == +Brian d foy <[EMAIL PROTECTED]> writes: +Brian> my @sorted = map { $_->[0] } +Brian> sort { $a->[1] cmp $b->[1] } +Brian> map { [ $_, substr($_, 2, 3) ] } +Brian> @lines; Except that the substr() function is likely not expensive enough

Re: sort in a file using Perl

2001-09-06 Thread +brian_d_foy
In article <005e01c1370a$1a1fd920$f95314ac@04778-9>, [EMAIL PROTECTED] (McGregory Pinto) wrote: > How i do a sort, like "sort -k3,5 -d" "" command, in a file using Perl. you can use a Schwartzian Transform with the sort key being the part of the string that you extract with substr: my @sorted

sort in a file using Perl

2001-09-06 Thread Mcgregory Pinto
Hi ... How i do a sort, like "sort -k3,5 -d" "" command, in a file using Perl. Sorry my bad english. Gregory.