my $pos= tell(DATA); chomp( my $x= ); warn "Testing($x)"; { my $fh= do { local(*FH); \*FH }; open $fh, "<&DATA" or die "Can't save DATA: $!\n"; close DATA or warn "Can't close DATA: $!\n"; open DATA, "<&=".fileno($fh) or die "Can't restore DATA: $!\n"; seek DATA, $pos, 0 or die "Can't reposition DATA: $!\n"; } warn "Testing"; chomp( $x= ); warn "Testing($x)"; __END__ some data #### Testing(some data) at redata.pl line 4, line 1. Testing at redata.pl line 12. Testing(some data) at redata.pl line 14, line 1.