Ugly hack:
producesmy $pos= tell(DATA); chomp( my $x= <DATA> ); 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= <DATA> ); warn "Testing($x)"; __END__ some data
which is what you asked for but needs some serious encapsulation work at least. - tye (but my friends call me "Tye")Testing(some data) at redata.pl line 4, <DATA> line 1. Testing at redata.pl line 12. Testing(some data) at redata.pl line 14, <DATA> line 1.
In reply to (tye)Re: Closing and re-opening the DATA Filehandle
by tye
in thread Closing and re-opening the DATA Filehandle
by Adam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |