in reply to Changing each item in an array

You should use an array or a hash instead of separate variables. What happens when you add $four, $five, and $five_hundred_fifty_five? I have no idea how you are setting $one, $two, and $three, but i'll bet it's not pretty.

You don't have to use CGI.pm, but here is an example script that does. The usage for CGI.pm's checkbox_group() method is quite daunting - i still have to refer to the docs (and sprinkly a little chicken blood) when using it. The key is to create a hash whose keys are the values of the checkbox, and whose values are the labels of the checkbox (i wish that were the other way around, btw). For example:

my %label = ( one => 'foo', two => 'bar', three => 'baz', );
From here, it's just a matter of faith to create a checkbox_group:
print checkbox_group( -name => 'checkbox', -values => [keys %label], -labels => \%label, );
But now that that complexity is over, look how easy it is to create another hash whose keys are one, two, and three, and whose values are either yes or no:
# create an array whose keys all have values 'no' my %checkbox = map { $_ => 'no' } keys %label; # update each found key's value to 'yes' $checkbox{$_} = 'yes' for param('checkbox');
Here is a complete script that you can tinker with:
#!/usr/bin/perl -T use strict; use warnings; use CGI qw(:standard); my %label = ( one => 'foo', two => 'bar', three => 'baz', ); print header, start_html('checkbox test'), start_form, checkbox_group( -name => 'checkbox', -values => [keys %label], -labels => \%label, ), submit('go'), end_form, ; if (param('go')) { my %checkbox = map { $_ => 'no' } keys %label; $checkbox{$_} = 'yes' for param('checkbox'); print table({border=>1}, Tr(th[qw(Var Val)]), map Tr(td[$_,$checkbox{$_}]), keys %checkbox ); }
Hope this helps. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)