go ahead... be a heretic | |
PerlMonks |
Re: Get record separator of a fileby karlgoethebier (Abbot) |
on Nov 14, 2012 at 13:11 UTC ( [id://1003796]=note: print w/replies, xml ) | Need Help?? |
I tested my four subs (my basic intention). Unfortunately it seems as there was some confusion about recsep, line seperator and record seperator. Normally Tie::File treats every line of a file as record, except one changes this behaviour. Or vice versa, loading a file under Windows with has "\n" as line separator led to that Tie::File loaded all data into $array[0]. After setting the recsep option to \n everything worked as expected. From the documentation if Tie::File: recsep 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".) You may change the definition of "record" by supplying the recsep option in the tie call: tie @array, 'Tie::File', $file, recsep => 'es';. The correct question should better have been: "How can i get the line seperator from a file...?". Thank you for help to all and best regards, Karl «The Crux of the Biscuit is the Apostrophe»
In Section
Seekers of Perl Wisdom
|
|