in reply to Special characters ignored

Perl isn't ignoring them, it's removing them. The <FILE> command reads one line from the file, and strips the carriage return, newline characters.

To stop it, undefine $/ with local $/;

____________________
Jeremy
I didn't believe in evil until I dated it.

Replies are listed 'Best First'.
Re: Re: Special characters ignored
by Chady (Priest) on Oct 03, 2001 at 17:25 UTC

    In the original post, tigervamp undefed $/ so I think (IMHO) that it is happening because it doesn't put the EOF marker inside the variable, and that \r\n are taken as one ENTER character, depending on the platform.

    update: removed semicolon after $/ - it won't die here ;~)


    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
Re: Re: Special characters ignored
by tigervamp (Friar) on Oct 03, 2001 at 17:26 UTC
    I did undefine $/, in the first line of my example. I also tried it your way, no luck.

    tigervamp

      Whaddya know, I am an idiot after all.

      To redeem myself slightly I will explain that local $/; is better because at the end of the code block (pretty much anything in curly braces) $/ will return to it's previous value, thus preventing you from mysteriously jinxing other subroutines.

      It doesn't matter in one liners but if you read from two files $/ applies to both - so changing it changes both file handles.

      ____________________
      Jeremy
      I didn't believe in evil until I dated it.