#!/usr/bin/perl use warnings; use strict; # test_stderr # This script is intended to illustrate how text output can be sent # to STDERR as well as STDOUT. # It can be used for testing output redirection in shell scripts. # # In the Bash shell, you can redirect both STDOUT and STDERR using "&>" # E.g.: ./test_stderr &> foo # But if you want to append to a file, you'll need to use the usual Bash # incantation for sending STDERR to STDOUT: "2>&1" and it needs to be at # the end of the command line, e.g.: ./test_stderr >> foo 2>&1 # # Cameron Hayne (macdev@hayne.net) June 2006 print STDOUT "This message is going to STDOUT\n"; print STDERR "This message is going to STDERR\n";