Thanks, I guess there's something else wrong. The array works fine but when I write it to an output file, it double spaces everything instead of prints an exact replicate. If I s/\n//, everything will be on the same line and that would be messed up too. Any suggestions?
open (FILE, "> redo-output.txt") or die "Error: $!"; foreach (@lines) { print FILE "$_\n"; } close(FILE);
Results:
# Since the submit button was pushed, we have to check to see if t +he username # they typed exists. $passwords is actually the hash we made earl +ier, but since # we are using just ONE value we call our passwords hash as a scal +ar: $passwords. # To lookup a hash key to see if it exists, you use: if (exists $h +ash{"key"}) {}.
Instead of:
# Since the submit button was pushed, we have to check to see if the u +sername # they typed exists. $passwords is actually the hash we made earlier, + but since # we are using just ONE value we call our passwords hash as a scalar: +$passwords. # To lookup a hash key to see if it exists, you use: if (exists $hash{ +"key"}) {}.

In reply to Re: Re: reading file into an array by Anonymous Monk
in thread reading file into an array by Anonymous Monk

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.