in reply to How to print bunch of data in a file without breaking in to new line

perldoc -f print

See also perlintro

  • Comment on Re: How to print bunch of data in a file without breaking in to new line

Replies are listed 'Best First'.
Re^2: How to print bunch of data in a file without breaking in to new line
by Udhay (Initiate) on Jul 31, 2012 at 16:27 UTC

    Hi,

    Thanks, for your quick response.

    I have stored all the contents of a HTML file in a variable. While i'm printing the data in a file, the content breaks in to new line exactly where the closing tag </p> or </span> or </div> appears, but it should not.

      It can get confusing with html documents, because the html bracket return acts as a newline. Here is a simple way to clean your html.
      #!/usr/bin/perl use warnings; use strict; open (FH,"< zz.html") or die "$!\n"; read( FH, $buf, -s FH ); close FH; #print "$buf\n"; $buf =~ s/\n//g; # strips out all newlines open (OH,"> zz_out.html") or die "$!\n"; print OH $buf; close OH; # zz_out.html will not have any newlines when viewed with a text edito +r, but will still be viewable in a web browser

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh