my @lineitems = @{ $ARGS{ LineItem } }; foreach my $line (@lineitems) { print "line is $line"; my $first = $ARGS{"first-$line"}; my $second = $ARGS{"second-$line"}; my $third = $ARGS{"third-$line"}; print "first is $first"; print "second is $second"; print "third is $third"; }