B::Deparse would've answered your question. This is how perl sees your program:
BEGIN { $^W = 1; } use CGI; use CGI::Pretty; use File::Basename; use DirHandle; use strict 'refs'; my $path = dirname('c:/pictemp/start.gif'); my @files; opendir DIR, $path; @files = readdir DIR; my $junk; if ($files[0] eq '.') { $junk = shift @files; } if ($files[0] eq '..') { $junk = shift @files; } my $query = 'CGI'->new; print $query->header('text/html'), $query->start_html(-'title', 'Renam +ing Digital Photos', -'bgcolor', '#ffffcc'); print "<form name=newNameForm method=post action=rename.cgi>\n"; print $query->input({-'name', 'baseDir', -'type', 'hidden', -'value', +"$path"}); print "\n<table border=1><tr valign=top>\n"; my $file; my $counter = 0; my $tempFile; foreach $file (@files) { $tempFile = $path . '/' . $file; print "<td>\n\t" . $file . "<br>\n\t"; print $query->input({-'type', 'hidden', -'name', "'hidden'.$counte +r", -'value', "$file"}); print "\n\t"; print $query->input({-'type', 'text', -'name', "'newName'.$counter +", -'size', '30', -'value', $file}); print "\n\t<img width=200 src=" . $tempFile . ">\n\t</td>\n"; if (++$counter % 3 == 0) { print "</tr><tr valign=top>\n"; } } print '</tr></table>'; print closedir DIR;
print closedir DIR; will print 1 if closedir returns true.

In reply to Re: CGI throws in an extra character. Why? by Anonymous Monk
in thread CGI throws in an extra character. Why? by Petras

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.