When I read in a line from a file, I check for the octal value of 14 to show the 'SHIFT OUT' for a new page.
However when I go and process the lines to create a new output document, it will not print the character for a 'SHIFT OUT'. I have even tried to past it in as hardcode and yet it still will not print.
#!/usr/bin/perl
use CGI qw(:standard);
open(INFO, "testdoc.txt");
print header();
print start_html();
my @record;
my %hash;
my $true = 0;
$i =0;
my $FEI;
($sec,$min,$hour,$mday,$mon,$year,$wday,
$yday,$isdst)=localtime(time);
#printf "%4d-%02d-%02d %02d:%02d:%02d\n", $year+1900,$mon+1,$mday,$hou
+r,$min,$sec;
open (OUT, '>OUTPUT.txt');
while ($line = <INFO>){
print $line . "<BR>";
#check each character of the line for a page break
for (split//,$line) {
$test = sprintf "\%3o\n", ord $_;
if ($test == 14) {
# WE HAVE FOUND A NEW PAGE
$true = 1;
$hash->{$i} = $line . $test;
$i++;
# store next 8 lines in a hash
}
}
}
}
This isn't the full code but a sample of the section I am talking about.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.