www.perl.com
Perl Programming
Standard Files
  • Standard files are opened automatically
    • STDIN is standard input
    • STDOUT is standard output
    • STDERR is standard error output
    • Can re-open these for special handling
    • print uses standard output by default
    • die and warn use standard error by default

        print STDOUT "Hello, world.\n";  # STDOUT not needed

        open STDERR, ">> logfile" or die "Can't redirect errors to log: $!";
        print STDERR "Oh no, here's an error message.\n";
        warn "Oh no, here's another error message.\n";
        close STDERR;
      
Previous http://stuff.mit.edu/iap/perl/