in reply to Incrementing Form inputs
Though I'd be more likely use printf and an array slice for clarity in this case:for my $i ($i=1; $i<=243; $i++) { print FH "$FORM{'item' . $i}\t$FORM{'qty' . $i}\n" if $FORM{'qty' . $i}; }
for (1..243) { printf FH "%s\t%s\n", $FORM{"item${i}"}, $FORM{"qty${i}"} if $FORM{"qty${i}"}; }
The braces aren't strictly necessary here, but will prevent confusion in the future if you need to append a static string after the interpolated variable.
|
|---|