in reply to Trash in my prints

Tried that, but print '';exit; gives the \x0A alone.

Anywhere else to look?

Replies are listed 'Best First'.
Re^2: Trash in my prints
by jwkrahn (Abbot) on Aug 18, 2011 at 20:31 UTC

    Try it like this:

    { local $\; print '1'; }

      That did the trick.

      The code where I found this problem spits a file as an attachment to the browser, kinda looks like this:

      sub render_file { my ( $x, %p ) = @_; my $content = read_file( $p{name}, binmode => ':raw' ); print $content; return Apache2::Const::OK; }
      nothing really complex. I didn't know $\ would affect the output of print, or rather, didn't know mod_perl would set it like blindluke says.

      What really strikes me as odd now is the fact that the code hasn't changed in ages and no one had noticed it was broken...

      You learn something new everyday. Thanks everyone!

        nothing really complex. I didn't know $\ would affect the output of print, or rather, didn't know mod_perl would set it like blindluke says.

        mod_perl does not set it, it even warns you about these ($\) special global variables