Hello all, Thanks to Charles and Tim, I have advanced to the final step with my script. After the script verifies that there is line (Summary Log...) and that the log is from correct year and month. I want it to find a line where is " Impressions: XX" and retrieve that value. However I got 0 (zero) as an result, even tough I know that there are values (Impressions).
The script now looks like: #!usr/bin/perl -w use strict; use Fcntl qw[:flock]; my $impressions = 0; my $iofile = '/other/XPSmaint/scripts/billing/daniel/input/c07_impressions_io.info'; open (IO, $iofile) || die("Could not open file 1!"); while (<IO> ) { chop; my ($FH, $output, $file2check, $month, $year) = split (/\s+/, $_); open OUT, ">> $output"; chdir $FH or die "$!"; while (glob $file2check) { open FH, $_ or die $!; flock FH, LOCK_SH or die $!; while (<FH> ) { chomp; if ( / Summary Log \(generated:/ ) { my($emptyspce, $summary, $log, $generated, $day_word, $monthfile, $day_number, $time, $timezone, $yearfile ) = split(/\s+/, $_); #print "File $file2check is $monthfile, $year\n"; if ($monthfile eq $month and $yearfile eq $year){ #print "File has this year: $yearfile and month: $monthfile in it.\n"} if ( /Impressions:/ ) { my($text, $value) = split(/:/, $_); $impressions += $value if ($value =~ /\d+/); } } } } close FH or die $!; } print OUT 'Total impressions: ', $impressions or die $!; } Any suggestions? Thank you for your time. danield -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>