in reply to Reducing a line read into $_

This is a comment on your coding style, not your question.

All of your dies are uninformative. You will head a lot of future headaches off at the pass if you take a page from perlstyle and start working like this:

my $logfile = "commandpost.log"; open (LOG, "< $logfile") or die "Cannot read $logfile: $!";
(Incidentally I noticed a syntax error in your code there as well.) The point being to make sure that if something goes wrong you have enough information to be able to track down the problem.