for (1..243) { printf FH "%s\t%s\n", $FORM{"item${i}"}, $FORM{"qty${i}"} if $FORM{"qty${i}"}; }