in reply to Re: Re: Display $var content
in thread Display $var content

On Windows, $/ is still "\n". The "\r\n" line-endings are converted to "\n" automatically when a file is read, and "\n" is converted to "\r\n" when a file is written. (Unless binmode has been called on the filehandle.)

On a Mac, $/ is still "\n", but "\n" means "\015" and "\r" means "\012".

So, if $/ has not been set explicitly,

$orig = <>; chomp($new = $orig); $new = "$new\n"; print $orig eq $new ? "yes" : "no";
will print yes on Unix, Windows, and Mac.

Of course, if $/ has been changed, then all bets are off. :)