I have this piece of code:
#!/usr/local/bin/perl
use strict;
open my $output, ">", "D:\\abc.txt";
for ( my $i = 0; $i < 10; $i++ )
{
print $output $i . "\n";
sleep(5);
}
Surprisingly, when I run it and open abc.txt in the 50 seconds while the machine is running, I don't see the current output. I would expect that after 13 seconds, for example, the file would include "0\n1\n2", but it doesn't, for some reason.
I reviewed other pieces of code which I wrote and actually do that, but I couldn't find any difference.
Can you please help me?
Thank you in advance.