in reply to CTRL M characters ?

First guess is that $file came from a CP/M-ish platform and has \cMs in it to begin with.

Replies are listed 'Best First'.
Re^2: CTRL M characters ?
by itub (Priest) on Jan 31, 2005 at 22:48 UTC
    In case the OP is not familiar with what CP/M-ish means, let me expand that a bit.
    • "Unix-ish" systems have a line feed ("\n" or Control-J or "\012") between lines in text files
    • "Mac-ish" systems have carriage returns ("\r" or Control-M or "\015")
    • "CP/M-ish" (usually meaning DOS or Windows) have both ("\r\n")

    For more details, search for "newlines" in perlport