my $output; # this value is unintialized open my $old_stdout, '>&=', \*STDOUT; close STDOUT; # Use of uninitialized value in open at the following line open STDOUT, '>', \$output;