Beat: Problem mit Tie::file und zeilenende

Beitrag lesen

als erstes ich habe die Anleitung gelesen zumindest die von perldoc http://perldoc.perl.org/Tie/File.html
aber WO steht da bitte eine Lösung zu meinem problem? also ich finde nix.

Zunächst wird aus deinem Code das problem nicht klar, weil du uns verschweigst, wonach du in s/// suchst.

Über Tie::file find ich extrem wenige Anleitungen und auf keinem finde ich eine Antwort.

Wenn du über einen mit tie gebundenen Array iterierst, dann hat das Alieaselement kein \n am Ende.
Du aber splittest wohl deinen String so, dass das letzte Element ein "\n" am Ende hat.

Der Versuch, einen Linefeed anzuhängen erübrigt sich bei Tie File, weil das bei untie automatisch durchgeführt wird.

"Records read from the tied array do not have the record separator string on the end; this is to allow

$array[17] .= "extra";

to work as expected.

(See autochomp, below.) Records stored into the array will have the record separator string appended before they are written to the file, if they don't have one already. For example, if the record separator string is "\n", then the following two lines do exactly the same thing:

$array[17] = "Cherry pie";
        $array[17] = "Cherry pie\n";"

mfg Beat

--
Woran ich arbeite:
X-Torah
><o(((°>        ><o(((°>
   <°)))o><                      ><o(((°>o