Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Find a file with same name but different extension

by toolic (Chancellor)
on Sep 24, 2013 at 14:06 UTC ( #1055501=note: print w/ replies, xml ) Need Help??


in reply to Find a file with same name but different extension

With lots of assumptions...

use warnings; use strict; use File::Basename qw(fileparse); use File::Slurp qw(slurp); for my $fin (glob '*.in') { my $fout = (fileparse($fin, qr/\.in/))[0] . '.out'; my @ins = slurp($fin); my @outs = slurp($fout); my $id_in = (split /\s+/, $ins [3])[5]; my $id_out = (split /\s+/, $outs[1])[4] . '0'; if ($id_in eq $id_out) { print "match\n"; } else { print "no match\n"; } }


Comment on Re: Find a file with same name but different extension
Download Code
Re^2: Find a file with same name but different extension
by Lotus1 (Chaplain) on Sep 24, 2013 at 19:54 UTC

    This seems like a good place to use Tie::File instead of File::Slurp since you only need the first few lines of the files.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-12-20 05:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls