Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Welcome to the Monastery
 
PerlMonks  

Re: Open Has a New Trick

by rob_au (Abbot)
on Oct 02, 2002 at 21:55 UTC ( #202389=note: print w/ replies, xml ) Need Help??


in reply to Open Has a New Trick

I found this feature in the 5.8.0rc2 and made comment on it as a means by which to perform temporary file-type operations within memory space in this follow-up comment to my tutorial on Using Temporary Files in Perl.

Another nifty feature in 5.8.0 to do with the open function and temporary files is the creation of anonymous file handles. For example:

open( $fh, '+>', undef ) || die $!;

Where the undefined value is a literal undef statement, rather than an undefined variable. This syntax will open a file handle and where permitted by the file system, unlink the file while holding it open. The result is an anonymous STDIO stream which will be lost when the file handle is closed.

Note too that this anonymous file handle functionality is also available through the File::Temp module which has been incorporated into the core 5.8.0 distribution.

 

perl -e 'print+unpack("N",pack("B32","00000000000000000000000111000110")),"\n"'


Comment on Re: Open Has a New Trick
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://202389]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2014-04-16 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (425 votes), past polls