in reply to Parsing cgi variable lists

What errors are you getting? I don't know the first thing about Mason, but this bit

values $ARGS{LineItem}
looks wrong, because the argument to the values builtin should be a hash, and $ARGS{ LineItem } is a scalar. Maybe you want something like this?
values %{ $ARGS{ LineItem } }
Likewise, I suspect this
my @lineitems = $ARGS{"LineItem"};
is not doing what you want (it creates an array of one item, which, in this case at least, would not warrant iterating over with a foreach loop). Maybe you want
my @lineitems = @{ $ARGS{ LineItem } }
but both this and my earlier suggestion can't both be right (Perl doesn't permit something that is a reference to both an array and a hash).

There are other basic syntax errors in your code, which suggests to me that reading perldata, perlreftut, and perlref would be useful to you. Otherwise I think you will be "programming by trial and error", which is not only painful but dangerous, because your only indication of success is when the thing "runs" and terminates normally. A program can easily pass this test and still be completely wrong.

Also, from your code it is not clear to me what $i (i.e. ${i}) is.

the lowliest monk