in reply to Re^4: ASCII insert after read
in thread ASCII insert after read
$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.
|
---|