Hi, I'm new here, and I have a question. I am working on a script that one of the components is reading in a html file and then printing it at the appropriate place. I did this fine in a test file, it is coded like this:
#!/usr/local/bin/perl -w use CGI qw(:standard :html3); #print "hello\n"; $locat = "../../htdocs/elghome/material_office.html"; print header, start_html; open (FILE1, $locat) || die ("Material_Office open failed: $!"); while (<FILE1>) { $page .= $_; } close(FILE1); print "$page\n"; print end_html;
Now I put most of that code into another working script, one of the many I want to use it on. And strange enough, it does not work. I have gone through varios tests to see why, but the only thing I know, is that for some reason it is not reading it in correctly. The code I use in the other script is:
$locat = "www.nsn.org/elghome/material_office2.htm"; open (HTMLP,$locat); while (<HTMLP>) { $pageht .= $_; } close(HTMLP);
Further down I use this code to print it out:
<hr> <p>$pageht <hr>
I do get the 2 lines but, with nothing inbetween. And it works in a script all by itself. If anyone has suggestions, I would be more than happy to try anything. Thanks, Midnite

In reply to Printing a Html Page by Midnite

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.