My theory is this: You have an array that holds the original file data; you then create some array which you modify via the splice. You then output the keys that you want to keep. You then read in the now modified file into the original array that you started with via some method that is not clearing the array before you read into it.
Notice how the last C is leftover? The reason I suspect this is because the results you report look like the original list overwritten with the new list, but not erasing the originals that are left beyond the end of the list.read from file to @orig @orig = [ 1 2 3 4 A B C ] @mod_copy = [ 1 2 3 4 A B C ] splice @mod_copy @mod_copy = [ 1 2 3 4 A C ] print join of @mod_copy to file file is now ( 1 2 3 4 A C ) read from file to @orig by indexing @orig = [ 1 2 3 4 A C C ]
In reply to Re: Datafile doesn't update before being read
by Sifmole
in thread Datafile doesn't update before being read
by ghopper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |