in reply to Display $var content

A side comment having nothing to do with the question you asked.
while ($HTMLLine=<HTMLFNH>) { chomp $HTMLLine; print "$HTMLLine\n"; }
This seems odd. Chomp removes the trailing newline, only to have it added again for the print. I suspect that there's some cargo-cult programming involved here.
while ($HTMLLine=<HTMLFNH>) { ... whatever you need to do for interpolation print $HTMLLine; }
should be sufficient.

Replies are listed 'Best First'.
Re: Re: Display $var content
by extremely (Priest) on Feb 27, 2001 at 04:04 UTC
    Chomp doesn't remove the trailing newline, It removes any line ending that corresponds to the current value of $/ which isn't always "\n". On DOS/WinXx machines it winds up being "\r\n" and under Mac winds up being "\r" if I remember them right. It can't hurt to let it alone as it might drop a few chars from the overall transmission and may make some wonky web clients a bit happier...

    --
    $you = new YOU;
    honk() if $you->love(perl)

      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. :)