> I have been trying to craft a regex to eliminate the last CRLF in the
> ... string [which] has many CRLF sequences but I need the last set dropped.
1. Religious affairs
Looks like you're in paragraph ($/="") or slurp ($/=undef) mode on Unix but
reading DOS files. Or you're using RAW/Binary mode. If however you *are* on a
so-called OS that likes \cM\cJ , if you let Perl merge CRLF into \n, life is
a lot easier. If you're not on an OS that invokes the magic \cM\cJ -> \n
transition, you can probably set some odd variable to cause that ... or if
not, I'm sure there's a magic IO module to invoke that behavior.
2. Hammers pounding screws? Chainsaw pounding nails?
Why use s/linenoise/$partToSave/ to delete two fixed chars when
if (/\cM\cJ$/) { chop; chop; } ## Not CHOMP, $/=""
or even
chop;chop; ## Remove last \cM\cJ
will do?
Or, my favorite,
chop while /\s$/; ### Omit all trailing whitespace,
### including whole blank lines at the end
### and last CRLF or NL or whatever is holy
(Yes, \s matches \cM \cJ \n \r and a few others like the obvious \t and ' '.)
cheers,
bill
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm