![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Foreach in a 2D arrayby ihb (Deacon) |
on Oct 29, 2004 at 15:57 UTC ( #403797=note: print w/replies, xml ) | Need Help?? |
Now that you've gotten answers to your question, I figured I'll answer the real question and give an answer that you can't easily read yourself to about data structures. The first and most interesting part is to redesign the data structure. It seems that you want an ordered list and therefore have an array with the columns, but you also want to have several values attached to that value. My suggestion is that you consider having a data structure looking like which would remove the need for parallel data structures. Your code would then look like As a side note, I think that print statement is more clearly written using printf() and another qoute delimiter: But really, this is unnecessary. CGI already implements a &radio_group subroutine that we can use and get rid of the loop altogether. The end result is
If you at any time would like to do a lookup of which values that are accepted for a radio group you can degenerate your @data to %dataoptions by using
Related documents:
ihb
See perltoc if you don't know which perldoc to read!
In Section
Seekers of Perl Wisdom
|
|