my $checksize1 = qq{Huge wad of html}; # Run ./cgi-local/axis/ax.pl over $checksize1 # Note, calling qx{} is the same as using backticks # calling qx{} in an array context means each # separate line returned is added as the next # element in an array. If you want it all in # a single scalar, call it in scalar context. # doing things this way assumes that ax.pl is # happy to take info on STDIN my @results = qx{ ./cgi-local/axis/ax.pl < $checksize1 }; #### $checksize1 = qx{ ./cgi-local/axis/ax.pl < $checksize1 }; #### my $checksize1 = qq{\n\n\n\nHuge wad of html\n\n}; my ($head, $body, $foot) = $checksize1 =~ m{(.*)(.*)(.*)$}si; $body = qx{./cgi-local/axis/ax.pl < $body}; $checksize1 = qq{$head\n$body$foot}; #### open(FILE, "> blah.shtml") or die "$!"; print FILE $checksize1; close(FILE); my $res = qx{./cgi-local/axis/ax.pl blah.shtml}; if($res ....){} # don't forget to ensure that ax.pl worked.