#!/bin/perl5 use strict; use warnings; open ERRORFILE, ">>myprogram.error" or die "Can't open myprogram.error"; open SAVEERR, ">&STDERR"; open STDERR, ">&ERRORFILE"; select STDERR; $| =1; print STDERR "stderr 1\n"; close STDERR; open STDERR, ">&SAVEERR"; print STDERR "stderr 2\n"; #### Name "main::SAVEERR" used only once Name "main::ERRORFILE" used only once