open F1,"<1st.file" or die "can't open 1st.file: $!"; chomp(my @order = <F1>); close F1; my $c = 'a'x (1+(log @order)/3); my %order = map {$_ => ++$c} @order; open F2,"<2nd.file" or die "can't open 2nd.file: $!"; print map{/\|(.*)/s} sort map{$order{(/([^|]*)/)[0]}."|$_"} <F2>; close F2;
In reply to Re: Sorting with perl
by I0
in thread Sorting with perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |