$hash->{$i} = printf("$line %d",$_);

This line seems so wrong to me. printf prints something to STDOUT, and returns 1 on success. So this will basically store 1 in $hash->{$i}. Also the hash keys are always numerical - why use a hash at all? An array seems much more appropriate, and easier to handle.

print OUT $hash->{3};# . "\n"; print OUT $hash->{4};# . "\n"; print OUT $hash->{5};# . "\n"; print OUT $hash->{6};# . "\n"; print OUT $hash->{7};# . "\n"; print OUT $hash->{8};# . "\n"; print OUT $hash->{9};# . "\n"; #print $hash->{1} . "1<br>"; print $hash->{2} . "2<br>"; print $hash->{3} . "3<br>"; print $hash->{4} . "4<br>";

Programming is mostly having the computer do the boring repetitions for you. No need for something like this, you have loops in Perl.

When I read in the text line by line, I can check for the 014 shift out ASCII character however when I use the print OUT $line the ASCII character is wrong.

If you don't tell me what "wrong" means to you I can't help you.

The output does contain a 014 character, but if you view it in a browser I guess you don't see it. hexdump is very well suited to inspect the output.


In reply to Re^5: ASCII insert after read by moritz
in thread ASCII insert after read by monkjeff

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.