Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Post file to hard disk
by premchai21 (Curate) on Apr 17, 2001 at 21:48 UTC
    perl somescript > somefile.html. If the output is HTML that is. However, I downvoted your post because:
    • you were not specific enough
    • you did not use proper HTML formatting
    • you were not specific enough
    • this is not actually relevant to Perl
    • you were not specific enough
    • it's in the wrong section
    • you were not specific enough

    Basically, you shouldn't just say what you are trying to do, but rather detail your specific situation. For instance, if I understand your situation correctly, you could have phrased it thus:

    "I am having some problems with a CGI script I am writing. When I run it, the output, of course, appears in my browser window. I would like it instead to go to a file. Any suggestions on how I could do this? Thanks in advance."

    Also, it is not specifically relevant to Perl. This is more either a shell redirection issue or a browser usage issue. Any CGI, not just one written in Perl, could be attached to this question. And even if it were, this really belongs in Seekers of Perl Wisdom. Perl Monks Discussion is for discussion related to the Perl Monks site itself, not necessarily specifically Perl stuff.

    Update: Your post has been moved to SOPW, thanks to chromatic.

      I'll try and be more specific next time.. hmm.. though it seems you were able to figure it out.. mew :).
      <http> <body> OOps.. does this look better?

      Will this line of code work if my verio uses ftp.pm ..?
      Thanx in advance.. :)

      Lisa.

      use NET::FTP;
      my $hostname='superwarez.com';
      my $user='warez';
      my $password='warez';
      my $ftp=Net::FTP -> new($hostname) or die ("Connect failed");
      $ftp->login($username,$password);
      $ftp->binary;
      $ftp->cwd("/pub/uploads");
      $ftp->put("mystuff.txt");
      $ftp->get("warezlist.txt");
      $ftp->quit
      <http> <body> OOps.. forgot the html thing... br>
      Will this line of code work if my verio uses ftp.pm ..?
      Thanx in advance.. :)

      Lisa.

      use NET::FTP;
      my $hostname='superwarez.com';
      my $user='warez';
      my $password='warez';
      my $ftp=Net::FTP -> new($hostname) or die ("Connect failed");
      $ftp->login($username,$password);
      $ftp->binary;
      $ftp->cwd("/pub/uploads");
      $ftp->put("mystuff.txt");
      $ftp->get("warezlist.txt");
      $ftp->quit
      Will this line of code work if my verio uses ftp.pm ..? Thanx in advance.. :) Lisa. use NET::FTP; my $hostname='superwarez.com'; my $user='warez'; my $password='warez'; my $ftp=Net::FTP -> new($hostname) or die ("Connect failed"); $ftp->login($username,$password); $ftp->binary; $ftp->cwd("/pub/uploads"); $ftp->put("mystuff.txt"); $ftp->get("warezlist.txt"); $ftp->quit
Re: Post file to hard disk
by TGI (Parson) on Apr 17, 2001 at 22:38 UTC

    You need to open a file and direct ouput to it:

    my $output_file = "script_out.txt"; open(FILE,">$output_file") or die "Unable to open $output_file for wri +ting: $!"; print FILE "This will go to the file.\n"; print "This will go to browser.\n"; select FILE; print "This will go to the file, too.\n"; print STDOUT "This will go to the browser.\n";


    TGI says moo

      Thanx.. that's pretty much nailed it. :) Lisa.
Re: Post file to hard disk
by nardo (Friar) on Apr 17, 2001 at 22:16 UTC
    If you want to do it in a programatic fashion, as opposed to "command > file" redirection, you can open the file and then select it.