Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: How to approach this problem, or should I ignore it?

by jethro (Monsignor)
on Apr 07, 2010 at 17:54 UTC ( #833362=note: print w/replies, xml ) Need Help??

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!
    Swiss Army Nerd

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833362]
[LanX]: jeez Singapore, Indonesia and the Philippines inherited 3 different kinds of plugs from their former colonial overlords

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2017-02-19 13:04 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (292 votes). Check out past polls.