Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Sorting with perl

by I0 (Priest)
on Aug 13, 2002 at 07:35 UTC ( #189721=note: print w/replies, xml ) Need Help??

in reply to Sorting with perl

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;