Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: matching twof files and print the output

by jwkrahn (Abbot)
on Dec 19, 2009 at 09:15 UTC ( [id://813499]=note: print w/replies, xml ) Need Help??


in reply to matching twof files and print the output

#!/usr/bin/perl use warnings; use strict; ( my ( $file_1, $file_2 ) = @ARGV ) == 2 or die "usage: $0 file_1 file +_2\n"; my $data = do { local $/; open my $FH, '<', $file_2 or die "Cannot open '$file_2' $!"; <$FH>; }; open my $FH, '<', $file_1 or die "Cannot open '$file_1' $!"; open my $WRITE, '>', 'output.txt' or die "Cannot open 'output.txt' $!" +; $\ = $/; while ( <$FH> ) { chomp; next unless /\S/; print $WRITE $data =~ /($_)\s+\d+(\s+\S+)/; } __END__

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-04-25 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.