in reply to File Sorting Question
Any solution is going to be expensive.
- Don't eat memory:
my $ignore = '(^The )|(^A )'; ... @sorted = sort { $a =~ s/$ignore//; $b =~ s/$ignore//; lc( $a ) cmp lc( $b ); } @indata;
- Or store better keys first:
%data = map { my $data = $_; s/$ignore//; ($_, $data } @indata; @sorted = @data{ sort{ lc( $a) cmp lc( $b)} keys %data };
Hope this helps,
Jeroen
"We are not alone"(FZ)
In Section
Seekers of Perl Wisdom