in reply to Tie::File Newline Issue
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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tie::File Newline Issue
by Lotus1 (Vicar) on Jan 30, 2014 at 20:29 UTC | |
|
Re^2: Tie::File Newline Issue
by omegaweaponZ (Beadle) on Jan 30, 2014 at 16:34 UTC |