#!/usr/bin/perl -l use strict; use warnings; my $x ; { local *STDOUT ; open STDOUT, ">$x" or die "nope\n"; print "this is stored in \$x" ; } print $x ;