http://www.perlmonks.org?node_id=991376


in reply to Simple Perl print() output redirect to html/webpage.

If you need to write everything thet print writes to a file, use select:

open my $html, ">", /srv/www/mystatus.htm; select $html;
If you want to call your Perl script from a webserver, you need to use CGI or CGI::Simple.

Please specify what exactly you want.

Sorry if my advice was wrong.

Replies are listed 'Best First'.
Re^2: Simple Perl print() output redirect to html/webpage.
by hmb104 (Sexton) on Sep 03, 2012 at 17:48 UTC

    My problem with using PHP passthru() is that it uses the user nobody to execute. The user nobody doesn't have write access & also PGP will not work with nobody and it is not recommended to give such access to nobody.

    My script returns 6 lines of print() statements, I dont want to make it a CGI script and add all the CGI related info to it. Can I create another CGI script and call it from within just to print my lines?

      Can I create another CGI script and call it from within just to print my lines?
      Why not? You can use the backtick operator or do + Capture::Tiny to get the stdout of your script.
      Sorry if my advice was wrong.