in reply to How to read a logfile and create a build script

#!/usr/bin/perl -w use strict; my $logfile = "/buildarea/logfile.log"; my $buildmsg = ""; open(FH,"$logifle") or die "Can't open $logfile"; $_=<FH>; if(/BUILD SUCCESSFUL/i){ $buildmsg = "BUILD SUCCESSFUL"; close FH; } else{ $buildmsg = $_; while(<FH>){ $buildmsg .= $_; } close FH; }
The above is untested, and is assuming that if a successful build occurs
that the message "SUCCESSFUL BUILD" will be the only thing inside the logfile

UPDATE:Thanks to AgentM for pointing out that by inserting last in the while loop, the script will end much more quickly.
UPDATE 2:Thanks also to chipmunk for noticing that the loop would have worked incorrectly by not even reading in the 1st line of the file. I made changes to the way the file is read, and it should work now.

TStanley
In the end, there can be only one!