Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: chrootChapter 5
Function Reference
Next: Reference: closedir
 

close

close filehandle

Closes the file, socket, or pipe associated with the given filehandle. You don't have to close filehandle if you are immediately going to do another open on it, since the next open will close it for you. However, an explicit close on an input file resets the line counter ($.), while the implicit close done by open does not. Closing a pipe will wait for the process executing on the pipe to complete, and it prevents the script from exiting before the pipeline is finished. Closing a pipe explicitly also puts the status value of the command executing on the pipe into $?.

filehandle may be an expression whose value gives a real filehandle name. It may also be a reference to a filehandle object returned by some of the object-oriented I/O packages.


Previous: Reference: chrootPerl in a NutshellNext: Reference: closedir
Reference: chrootBook IndexReference: closedir

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.