$ perl -le 'close(STDERR); open AA, ">/tmp/stderrtest"; warn "Hello"; close AA;'; cat /tmp/stderrtest Hello at -e line 1. $