in reply to Re: File contents not updated properly
in thread File contents not updated properly
Hi,
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...
Regards,
fmerges at irc.freenode.net
|
---|
In Section
Seekers of Perl Wisdom