Kones has asked for the wisdom of the Perl Monks concerning the following question:
print "Do you have any images? "; chomp($image_answer = <STDIN>); if($image_answer eq "yes" || $image_answer eq "y") { print "How many? (1-4) "; chomp($numPics = <STDIN>); &makeTable($numPics); } elsif($image_answer eq "no" || $image_answer eq "n") {print "No soup for you!\n";} sub makeTable { if($numPics==1){ print NEWCONTENT "<TABLE><TR><TD>"; print "Name of image 1: "; chomp(<STDIN>=$name1); print NEWCONTENT "<IMG SRC=pics/$name1></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/spacer.gif></TD</TR> \n"; print NEWCONTENT "</TABLE>"; print "Table for 1 created"; } elsif(numPics==2){ print NEWCONTENT "<TABLE><TR><TD>"; print "Name of image 1: "; chomp(<STDIN>=$name1); print "Name of image 2: "; chomp(<STDIN>=$name2); print NEWCONTENT "<IMG SRC=pics/$name1></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/$name2></TD></TR> \n"; print NEWCONTENT "</TABLE>"; print "Table for 2 created"; } elsif(numPics==3){ print NEWCONTENT "<TABLE><TR><TD>"; print "Name of image 1: "; chomp(<STDIN>=$name1); print "Name of image 2: "; chomp(<STDIN>=$name2); print "Name of image 3: "; chomp(<STDIN>=$name3); print NEWCONTENT "<IMG SRC=pics/$name1></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/$name2></TD></TR> \n"; print NEWCONTENT "<TR><TD><IMG SRC=pics/$name3></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/spacer.gif></TD</TR> \n"; print NEWCONTENT "</TABLE>"; print "Table for 3 created"; } elsif(numPics==4){ print NEWCONTENT "<TABLE><TR><TD>"; print "Name of image 1: "; chomp(<STDIN>=$name1); print "Name of image 2: "; chomp(<STDIN>=$name2); print "Name of image 3: "; chomp(<STDIN>=$name3); print "Name of image 4: "; chomp(<STDIN>=$name4); print NEWCONTENT "<IMG SRC=pics/$name1></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/$name2></TD></TR> \n"; print NEWCONTENT "<TR><TD><IMG SRC=pics/$name3></TD>"; print NEWCONTENT "<TD><IMG SRC=pics/$name4></TD</TR> \n"; print NEWCONTENT "</TABLE>"; print "Table for 4 created"; } else print "Number entered is not within accepted paramters. \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: HTML and Perl
by jeffa (Bishop) on Mar 10, 2002 at 21:50 UTC | |
|
Re: HTML and Perl
by dreadpiratepeter (Priest) on Mar 10, 2002 at 20:52 UTC | |
|
Re: Problem with an odd filehandle
by Zaxo (Archbishop) on Mar 10, 2002 at 21:14 UTC | |
|
Re: Problem with an odd filehandle
by chromatic (Archbishop) on Mar 11, 2002 at 02:51 UTC |