You need to turn autoflush(1) on for that filehandle..


my $oldfh = select FH ; $| = 1 ; select $oldfh ;

This should, of course, be done after you know FH was opened correctly :-)

On Tuesday, March 18, 2003, at 10:39 AM, Sabherwal, Balvinder (MBS) wrote:

Guru's

I have a script which writes to a file. For some reason, I see the writes
are being buffered. The file gets created as soon as I execute the script. I
don't see anything in the output file till the script ends.


Is there any way I can change this behavior so I can keep writing to the
file and will be able to see the data in the output file while the script is
still running. I an doing print to file handle in a loop. The file is open
for the write mode via the below syntax.


if ( -e $outfile )
{
die "\n\n *** ERROR *** Write permission denied on $outfile \n" unless(
-w $outfile );
die "*** Error *** Cannot open the file $opt_f to send output\n" if (
!open(FH,">> $outfile") );
}
else
{
die "*** Error *** Cannot open the file $opt_f to send output\n" if (
!open(FH,"> $outfile") );
}


Thanks
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to