in reply to Need to compare import Trailer to Result Log

would you be some kind to give us some sample data? Itīs hard for us to assemble code "out of the blue". But this could get you started (compiles but oviously untested).
use strict; use warnings; my @trailer; my @logfile; open IN, "trailer" or die $!; while (<IN>) { push @trailer, $1 if /Trailer(\d+)/; } close IN; open IN, "logfile" or die $!; while (<IN>) { push @logfile, $1 if /Total Records Imported :(\d+)/; } close IN; die "number of imports doesnīt match!\n" if @trailer != @logfile; for (0..$#trailer) { print "import no. $_: ", ($trailer[$_] == $logfile[$_] ? "ok\n" : +"not ok\n"); }
Update:
given the sample data you provided (hint: if you make a significant update to your node, make it visisble) i changed my code above as follows. It should do the trick:
use strict; use warnings; my @trailer; my @logfile; my $trailer; open IN, "trailer" or die $!; while (<IN>) {$trailer = $_} close IN; @trailer = (substr($trailer,10,8), substr($trailer,24,8)); @trailer = map { s/^0+//; $_ } @trailer; open IN, "logfile" or die $!; while (<IN>) { push @logfile, $1 if /Total Records Processed: (\d+)/; } close IN; die "number of imports doesnīt match!\n" if @trailer != @logfile; for (0..$#trailer) { print "import no. $_: ", ($trailer[$_] == $logfile[$_] ? "ok\n" : +"not ok\n"); }

holli, regexed monk