i dont know what you are trying to achieve, but even i had the same requirement for a XML file to calculate checksum after stripping all XML tags and bringing data into one line and calculating checksum crc32 on it , this was a requirement from one of our client

Why dont you try the below?
# call as: ConvertFindLaw.pl PilotLifeFindLaw.htm use 5.010; use Switch; use strict; my $wholeFile; my $INPUT_FILE = shift; my $FH; open(FH, $INPUT_FILE) or die "Bad $INPUT_FILE: $!"; ; while (<FH>) { # print $line; # All lines printed chomp $_; # This makes difference , if want it in one line $wholeFile .= qq~$_~; # Just use quoted qq } # Build a long string $wholeFile .= qq~\n~; # This is needed, when you say u want it in one +line, there should one new line character after doing appending in wh +ile loop, now when you do wc -l on this one, it will show one line close(FH); print $wholeFile; # front truncated here

* You should remember , if you are putting the resultant string in file and want to open it and see, i guess some editors have limitation in terms of number charcaters it can display in a single line, for ex: AIX5 , my vi editor cannot display more than 2048 characters in a single line.

As said by some of the monks , unless you specify what you are going to achieve, its difficult to suggest the solution.

In reply to Re: string gets front truncated by harishnuti
in thread string gets front truncated by hsfrey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.