Or, from the man page:
It has two separate effects. First, it automatically chomps $/ (the input record separator) when used with -n or -p. Second, it assigns "$\" (the output record separator) to have the value of octnum so that any print statements will have that separator added back on. If octnum is omitted, sets "$\" to the current value of $/.
Or, in the vernacular, if you include the -l option, it will add an end-of-line to each print.
--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee
| [reply] |
Don't get me wrong, the -l is very nice, but not when you cat files (especially not with binary files)! I cannot think of a situation in which this kind of behavior can be useful!!
Anyway from the suggested docs the answer to my problems was simple
{ local $\ ;
# do 'cat' stuff here
}
Thanks a lot
LuCa
UPDATE: I checked the code from the cpan module File::Cat and I would suggest to change the following while (<FILE>) {
print $handle $_;
}
into while (<FILE>) {
printf $handle $_;
}
(not tested) | [reply] [d/l] [select] |
You definitely do not want to use printf like that! The second argument in your example is the format string so any % characters in it will be interpreted by printf.
| [reply] [d/l] |
hmm, thats a very good point. Then
{ local $\ ;
while (<FILE>) { print $handle $_; }
}
would probably be the best solution, or do I miss something (again) ?
LuCa | [reply] [d/l] |