Append line numbers to the fields so I can bypass hash and array manipulation entirely. i.e item_no_1=1&item_no_2=2&item_no_3=3&qty_1=11&qty_2=12&qty_3=13)I make heavy use of this approach with sometimes more complex 'keys'. For instance:
(Edit: minor code addition, use strict, etc. :)use strict; use warnings; use CGI; my $q = CGI::new; # or however you get your $q ... # input names look like "id1~id2~id3" # or pick a delimiter you like instead of ~ for my $param ($q->param) { # print "$param<br/>\n"; next unless $param =~ /.*(?:~.+){2}/; my ($id1,$id2,$id3) = split(/~/,$param); # print "$id1 - $id2 - $id3<br/>\n"; # ... }
--
May the Source be with you.You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
In reply to Re: Handling Dynamic URL Parameters
by Solo
in thread Handling Dynamic URL Parameters
by the_Don
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |