sub invokeCmd { my ($cmd) = @_; # assuming full path for cmd, change path from # cmd area to results area my $curResultsFile=$cmd."res"; # stat the file, check for existence, and 'last mod' value if ($too_old) { # re-run command and store results in $curResultsFile } my $res; open $res, $curResultsFile or die "could not open results: $!\n"; return $res; }