Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://189721]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2016-10-01 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (3 votes). Check out past polls.