Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop syntax

Status
Not open for further replies.

eatr

Technical User
Jan 20, 2006
48
assuming I can use a set (tuple?) of values for a loop

what would be the correct syntax for looping with

double values
for example

[$p,$l] with values ([1,2], [3,4], [5,6])






 
A nested for loop should be what you're looking for, though I've never heard tuple used in this context
Code:
for ($i=0;$i<=10;$i++) {
  for ($j=0;$j<=10;$j++) {
    print "[$i, $j]";
  }
  print "\n";
}

Hope I got you right ;-)
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top