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

Re: How to iterate by fives?

by BrowserUk (Patriarch)
on Feb 15, 2003 at 23:18 UTC ( [id://235625]=note: print w/replies, xml ) Need Help??


in reply to How to iterate by fives?

This is one of those exceptions that proves the rule. This is one of the few cases when I think that the C-style for(;;) has much going for it relative to the (many) other possible approaches.

#! perl -slw use strict; use CGI qw[:standard *table]; my @data = 1 .. 103; print start_table( {-border=>1} ); for( my $i = 0; $i < $#data; $i += 5 ) { print Tr( td( [ map{ defined $_ ? textfield( { -name=>$_, -default=>$_ } ) : '&nbsp;' } @data[$i .. $i+4] ] ) ); } print end_table;

Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-23 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found