Hello. I'm just starting to learn to use Perl and CGI to read a text file and display the information in a webpage. For starters, all I am trying to do is open up the text file and print each line. The text file is located in the same location as the pl file.
I have this code:
It successfully prints out both 'hellos', but does print anything from the text file. What might I be doing wrong?
Thanks!
I have this code:
Code:
#!/usr/bin/perl
use CGI;
$q = new CGI;
print $q->header;
print $q->start_html();
open(stats, "032406.txt");
print "hello";
while (my $record = <stats>) {
print "Line: " . $record;
}
print "HELLO";
close(stats);
print end_html;
It successfully prints out both 'hellos', but does print anything from the text file. What might I be doing wrong?
Thanks!