http://www.perlmonks.org?node_id=833362


in reply to How to approach this problem, or should I ignore it?

I hope your script is well designed with subroutines to do the difficult tasks ;-). In that case you probably have a subroutine to generate a row of the html table. Then you just need to insert the following code (adapted to your circumstances, $x has a different name in your script):

$opcode=$x->{opcode}; while (@{$x->{subfields}}) { @params= splice(@{$x->{subfields}},0,5); generate_html_row($opcode,@params); $opcode=''; }

Beware, this changes your datastructure. if you can't have that, make a copy of @{$x->{subfields}} and loop over the copy

If you don't have that subroutine it should be easy to extract the relevant code and make it one. Ok, you could do the same inline, but readability is much better with subroutines for distinct tasks

Replies are listed 'Best First'.
Re^2: How to approach this problem, or should I ignore it?
by jedikaiti (Hermit) on Apr 08, 2010 at 16:05 UTC
    Thanks, jethro!
    Kaiti
    Swiss Army Nerd