pg probably already helped you out a lot, but I'd like to point your direction to HTML::Template too (there are even Tutorials about this: HTML::Template Tutorial and Using HTML::Template). I have started working on HTML::Template a couple of days back, and must say, it's a breeze for these kind of things.
Another thing I find perculiar about your code, is that you don't use CGI's capabilities much. For example, you could rewrite this:
print "<input type=hidden name= 'index' value='$i'>";
print "<input type=hidden name='uname' value='$nme'>";
print "<input type='image' src='http://typhoon.he.net/~bthcraft/$nme/i
+mages/tn_$dat->[$i]->[2]' name='image' height ='$heigh$
To:
print hidden("index",$i),
hidden("uname", $nme),
image_button(-name => "image",
-src => "http://typhoon.he.net/~bthcraft/$nme/i
+mages/tn_$dat->[$i]->[2]",
-height => $height,
-width => $width);
IMO, this makes it easier to read and it's less chars to type :)
|