use feature "switch"; # Redirect STDERR open my $err_fh, '>', 'stderr.log'; *STDERR = $err_fh; # Redirect STDERR open my $out_fh, '>', 'stdout.log'; *STDOUT = $out_fh; my $i; given($i) { print "$i\n" when $i < 4; } # Prove STDERR is redirected my $error = 10 / 0; #### C:\Users\ian\Perl>perl test.pl given is experimental at test.pl line 10. when is experimental at test.pl line 11. C:\Users\ian\Perl>