I have a few checkboxes on a form. I am trying to convert the ticked checkbox to 'yes', unchecked to 'no'.
I thought I could do the following:
But actually changes all $item to 'yes'my @array = qw($one $two $three); foreach my $item (@array){ if ($item) { $item = 'yes'; } else { $item = 'no'; }
Could anyone tell me what I am doing wrong and how I might achieve these chqnges.
Thanks
In reply to Changing each item in an array by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |