Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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


Comment on Re: How to approach this problem, or should I ignore it?
Select or Download Code
Re^2: How to approach this problem, or should I ignore it?
by jedikaiti (Friar) on Apr 08, 2010 at 16:05 UTC
    Thanks, jethro!
    Kaiti
    Swiss Army Nerd

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-12-26 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (167 votes), past polls