in reply to Confusing Syntax

Your code:
%pics( pic0 => $q->param("photo") , ... omissis ...
Try this instead (note the =):
%pics = ( ... omissis ...
Update: For the while part, you should look in perlsyn.