On Jun 19, 2006, at 22:45, Anthony Ettinger wrote:
# order matters
$raw_text =~ s/\015\012/\n/g;
$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
Does it make any difference if I use s/\cM\cJ/cJ/ vs. s/\015\012/\n/
g ?
The regexp i
Anthony Ettinger wrote:
> On 6/19/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
>> Anthony Ettinger wrote:
>> >># order matters
>> >>$raw_text =~ s/\015\012/\n/g;
>> >>$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
>> >>$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
>> >
>> > Does
On 6/19/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
Anthony Ettinger wrote:
>># order matters
>>$raw_text =~ s/\015\012/\n/g;
>>$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
>>$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
>
> Does it make any difference if I use s/\cM\cJ/cJ/
Anthony Ettinger wrote:
>># order matters
>>$raw_text =~ s/\015\012/\n/g;
>>$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
>>$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
>
> Does it make any difference if I use s/\cM\cJ/cJ/ vs. s/\015\012/\n/g ?
The string "cJ" in your example
# order matters
$raw_text =~ s/\015\012/\n/g;
$raw_text =~ s/\012/\n/g unless "\n" eq "\012";
$raw_text =~ s/\015/\n/g unless "\n" eq "\015";
Does it make any difference if I use s/\cM\cJ/cJ/ vs. s/\015\012/\n/g ?
Since the newline convention is not necessarily the one in the
r
On Jun 13, 2006, at 20:26, Anthony Ettinger wrote:
I have to write a simple function which strips out the various
newlines on text files, and replaces them with the standard unix
newline \n
In Perl "\n" depends on the system, it is eq "\012" everywhere except
in MacOS pre-X, where it is "\01
I have to write a simple function which strips out the various
newlines on text files, and replaces them with the standard unix
newline \nafter reading the perlport doc, I'm even more confused
now.
LF eq \012 eq \x0A eq \cJ eq chr(10) eq ASCII 10
CR eq \015 eq