You're not printing a header:
#!/usr/bin/perl -wT
use strict;
use CGI qw/ :standard /;
my $stats = 'statistics.txt';
open IN_RESULT,"< $stats" or die "Cannot open $stats for reading: $!";
my @in_result = <IN_RESULT>;
close (IN_RESULT);
my @armyImages = (
'"images/icon_army_dwarf.gif"',
'"images/icon_army_empire.gif"',
'"images/icon_army_lizard.gif"',
'"images/icon_army_orcs.gif"',
'"images/icon_army_skaven.gif"'
);
print header;
print <<WEB_PAGE;
.
.
.
Note that I added the "standard" stuff and made a change or two.
- I added use CGI. It's overkill here, though, so you could get away with print "Content-type: text/html\n\n"
- I added strict. If you're not sure why you need strict, then you need it.
- I also turned on warnings and taint checking. Taint checking doesn't seem useful here, but you are reading from an external source and if this program gets expanded, it could really protect you at some point.
- I added a test to see if your file open succeeded. If you have a silent failure, your script would still run and you might have a hard time figuring out why.
- I changed the name of your array to lower case to avoid confusion with the filehandle.
- I printed the header -- which is they key issue here.
I have to admit, from the names of your images, I'm very curious to see what you're putting together :)
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
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.