in reply to Parse the text file output and delete files
You might be interested to read up on the awk utility, which is one of the inspirations for Perl and still a very good tool for dealing with requirements like these. An awk program basically consists of a set of regular-expressions and blocks of code that are to be executed when the associated pattern is matched. awk reads the source-file line by line, testing each line. Not surprisingly, this translates easily and directly to Perl programs.
First the explanation, then the sample code. In this problem, there are basically two “lines of interest.” There is the executing: line, which contributes the name of the last script executed, and the ERROR at line, which tells us that we have something to do (with that name).
The meat-and-potatoes of the program will therefore look something like this: (extemporaneous code, untested)
#!/usr/bin/perl use strict; use warnings; $| = 1; my $filename; while (<>) { if ( /^executing: \@(.*)/i ) { $filename = $1; } else if ( /^ERROR at/i ) { unlink $filename or warn "can't unlink $filename: $!\n"); } }
Note the following:
HTH ...