7.2.54 SelectSaver - Save and Restore Selected Filehandleuse SelectSaver; select $fh_old; { my $saver = new SelectSaver($fh_new); # selects $fh_new } # block ends; object pointed to by "my" $saver is destroyed # previous handle, $fh_old is now selected # alternative invocation, without filehandle argument my $saver = new SelectSaver; # selected filehandle remains unchanged
A SelectSaver object contains a reference to the filehandle that
was selected when the object was created. If its When a SelectSaver object is destroyed, the filehandle that was selected immediately prior to the object's creation is re-selected. |
|