The stupid question is the question not asked | |
PerlMonks |
Able to open file, unable to readby feiiiiiiiiiii (Acolyte) |
on May 13, 2016 at 19:51 UTC ( [id://1162984]=perlquestion: print w/replies, xml ) | Need Help?? |
feiiiiiiiiiii has asked for the wisdom of the Perl Monks concerning the following question: Hi guys, I recently came across a weird error. It happened a few times. Seems very random, but usually tend to happen around a specific time. Below is the code:
The random error is, it's able to open the file (the die action never happens), but unable to read any data ($line is uninitialized) If I rerun it after a couple minutes, it runs fine and $line does get the data My best guess is that the bug is due to legacy "open(FILE, $file_name)" code. Because it did not specify "<" read mode, after it opens the file successfully, another program somehow gets able to write it. Then this program was not able to read it. Is that a fair guess? Anybody has better idea how to fix it? Thanks!
Back to
Seekers of Perl Wisdom
|
|