That shebang line isn't doing anything for you (aside from enabling warnings). I doubt your installation of strawberry Perl's executable resides at /usr/bin/.

Now for the issue: Each time through the loop you are assigning the value of $input to $array[0]. I assume the last line of the file is either blank or invisible (whitespace, or non-printing control characters), which is why you're seeing no output when you print @raw. You should change @raw=$input; to push @raw, $input;. Also, no need to pre-initialize $input to '', $first to '', and @raw to (). But the real issue is your assignment to @raw inside the loop; each iteration clobbers the previous value stored in @raw and assigns a new one to the first element.

In fact, if all you're doing is printing all the lines of the file with newlines stripped and one newline at the end, you don't need to push the file into an array. Just go straight to print.

while( <> ) { chomp; print; } print "\n";

If the script worked for you under a previous version of Perl as posted, your build of that previous version of Perl was broken; demand you money back! :)


Dave


In reply to Re: Input files <> by davido
in thread Input files <> by ostra

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.