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"; } }

Replies are listed 'Best First'.
Re^2: Find a file with same name but different extension
by Lotus1 (Vicar) 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.