if ($fileList[0]) { my $uploadCnt = 3; my $fileCnt = 1; for (;$fileCnt<=$uploadCnt;$fileCnt++) { my $upfile = $ARGS{"file_$fileCnt"}; ### this passes the file to the mason component I created to upload files my $fileRef = $m->comp("fileUploader.mas",upload_file=>$upfile); } }