From the documentation for Tie::File:
What is a 'record'? By default, the meaning is the same as for the <...> operator: It's a string terminated by $/, which is probably "\n". (Minor exception: on DOS and Win32 systems, a 'record' is a string terminated by "\r\n".)
For whatever reason, on Windows the line:
$file_lines[3] = "This is my new record on line 3,\n";
inserts \n only, so the “records” become confused. Change to:
$file_lines[3] = "This is my new record on line 3,\r\n";
and it works as expected. I don’t know if this is a bug, but it looks like one.
Note: $file_lines[3] accesses the fourth line, as line counting starts at zero.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Tie::File Newline Issue
by Athanasius
in thread Tie::File Newline Issue
by omegaweaponZ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |