http://www.perlmonks.org?node_id=809504


in reply to help need to read a listening log file

Hi, this is the code in <code>-tags...
#!/usr/bin/perl use strict; use warnings; my $installLogFile = $ARGV[0]; my $destinationlocation = $ARGV[1]; sleep 1 until -f $installLogFile; chdir($destinationlocation) || die $!; print "Changing directory to $destinationlocation\n"; chdir('logs') || die $!; my $lastLine = `tail /1 $installLogFile`; chomp($lastLine); my $secondLastLine = `tail /2 $installLogFile`; chomp($secondLastLine); $secondLastLine =~ s/$lastLine//; chomp($secondLastLine); if($secondLastLine eq 'SUCCESSFUL') { print "successful\n"; } else { print " was not successful \n"; exit; }