in reply to paragraph mode and <DATA>

7stud:

I tried your program and had the same results. When I looked at it via:

od -t x1 892874.pl

I noticed it had DOS/Windows line endings (\r\n). I notice that if you remove the carriage returns, it works just fine:

$ sed -b 's/\r//g' 892874.pl >t.pl $ perl t.pl ******************** hello world bye ******************** ******************** hello world2 bye2 ******************** ******************** end ********************

It also worked fine when I set $/ to "\r\n\r\n".

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: paragraph mode and <DATA>
by ikegami (Patriarch) on Mar 13, 2011 at 05:56 UTC

    I noticed it had DOS/Windows line endings (\r\n). I notice that if you remove the carriage returns, it works just fine:

    Or run it on Windows.

    ******************** hello world bye ******************** ******************** hello world2 bye2 ******************** ******************** end ********************

      ikegami:

      I did the whole song and dance because it's not enough to simply run it on Windows. When I reproduced it, I was running on Windows Vista. While the most common Windows builds (ActiveState & Strawberry) wouldn't have given this problem, there are builds (such as the one I use, cygwin) which act more like a unix version.

      Since I use an editor that doesn't add "\r" to the line ends, I don't normally encounter this issue, but I've encountered it a few times, and am sensitized to look for it.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

        cygwin isn't windows -- you can run it on windows, but you know its unix emulation, not windows

        I have no idea why you're claiming that a programs running in a unix emulator (e.g. cygwin) is running on Windows, or what your point you're trying to make in the process.

        Since I use an editor that doesn't add "\r" to the line ends, I don't normally encounter this issue, but I've encountered it a few times, and am sensitized to look for it.

        Indeed. Windows and unix use different line endings for text files. One must account for that when accessing a from the other system (be it via FTP, SMB or Cygwin).