Provides a way to save and restore filehandles so you can temporarily use a different filehandle.
new |
$saver = new SelectSaver[(fh)]
Constructor. Creates a new SelectSaver object, $saver, which saves the current filehandle. The optional parameter fh is the filehandle that will temporarily replace the current filehandle. If fh is present, the current filehandle is saved in $saver, and the new one becomes the current filehandle. With no parameter, the current filehandle is saved in the object $saver, and it remains current.
You can use the newly selected filehandle within the current block. When you exit the block, the previous filehandle is again made the current one, and the SelectSaver object in which it was stored is destroyed.
Copyright © 2002 O'Reilly & Associates. All rights reserved.