if (defined($cgi->param('ImageSubmit1.x')) { #Do some code associated with ImageSubmit1 } elsif (defined($cgi->param('ImageSubmit2.x')) { #Do some code associated with ImageSubmit2 }