Consider what will happen if this line fails (due to temporary disk full, for example):
print FILE unless ( $_ =~ /^\Q$std\E\b/ );
When you did open ">$stdInfo" you truncated the file, so if a print subsequently fails, you have permanently lost information from the $stdInfo file. You may not even know about it because you are not checking the return code from print or close. As already pointed out, opening in append mode seems best. If you must rewrite the whole file, write to a temporary file first, then rename after you are sure the rewrite has been successful.
In reply to Re: appending to a file
by eyepopslikeamosquito
in thread appending to a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |