in reply to JPEG cgi problem

Your "while(<FH>)" is reading a record into $_, which you are not using.

Change to:

while( ! eof FH )
or the equivalent.

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius