I am a beginner with perl and as a way to get some practice using it I decided to try to do random imaging with it. I have my own apache server set up on windows, which is where I intended to run it. I'm almost 100% sure that I have the server configured correctly because when I run the perl script it shows up on the server, the only problem is that the actual image does not appear. However, the area that it should be in shows up, but it shows up like it would if a image doesn't load on a webpage. I'm not sure if I need something else to allow me to get the images to appear or what. Here is the code that I have, if you have any suggestions or ideas let me know.
#!c:\perl\bin\perl.exe -w use strict; use strict "vars"; my @imgArray = ("./pics/blink.gif","./pics/sum41.jpg","./pics/ul.jpg", +"./pics/ltj.jpg","./pics/mest.jpg","./pics/blink2.jpg","./pics/blink3 +.jpg"); srand(time ^ $$); my $num = rand(@imgArray); print "Content-type: text/html\n\n"; print "Index: $num <br>Image: $imgArray[$num]<br><br>"; print "<center>Random imaging with Perl.....<br><br></center>"; if($num < 1) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=320 width=240><br><br><font>Blink 182 (1)</font></center +></body>\n";} elsif($num < 2) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=316 width=500><br><br><font>Sum 41</font></center></body +>\n";} elsif($num < 3) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=600 width=450><br><br><font>Unwritten Law</font></center +></body>\n";} elsif($num < 4) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=320 width=240><br><br><font>Less Than Jake</font></cente +r></body>\n";} elsif($num < 5) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=365 width=550><br><br><font>Mest</font></center></body>\ +n";} elsif($num < 6) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=322 width=356><br><br><font>Blink 182 (2)</font></center +></body>\n";} elsif($num < 7) {print "<body bgcolor=lightgrey><center><img src=$imgArray[$num] bor +der=1 height=536 width=678><br><br><font>Blink 182 (3)</font></center +></body>\n";} else {print "Error loading picture!";}
Thanks, KP

In reply to Random Imaging by appex32

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.