Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: File contents not updated properly

by fmerges (Chaplain)
on Dec 09, 2008 at 18:02 UTC ( #729229=note: print w/ replies, xml ) Need Help??

in reply to Re: File contents not updated properly
in thread File contents not updated properly


First of all, don't assume that you could open the file, check for it. Then use 3 argument open, and don't use a typeglob.

open my $fh, '>', $filename or die "Can't open $filename: $!";

The solution provided will leave the default handler to be *FH, which is not desired, meaning all prints, etc will use *FH; alternatives:

# not so maintainable, but still used frequently select((select($fh), $|++)[0]); # better use IO::Handle; $fh->autoflush(1);

Check out the link about buffering provided...


fmerges at

Comment on Re^2: File contents not updated properly
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2016-02-07 13:19 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (252 votes), past polls