Maybe something sets or resets $/.
Note that your code never can go into the if( $flag == 0 ) branch with the code as you show it. Maybe you want to add some debugging statements using warn. Your code can only one get into the $flag==0 branch.
I can only recommend reducing your code so that you produce a small, self-contained program (20 lines or so) that still has the problematic behaviour.
In reply to Re^3: Problem with appending files
by Corion
in thread Problem with appending files
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |