For Statement in Perl

by Geethalakshmi 2010-09-17 14:06:20

For Statement in Perl


The for statement performs a loop as long as a a tested expression is true, increasing the value for each loop.

for ( initial_expression; test_expression; increment_expression ) {
statement1;
statement2;
}

The following example prints the numbers 1 to 10.

for ($i = 1; $i <=10; $i++) {
print "$i ";
}

Tagged in:

694
like
0
dislike
0
mail
flag

You must LOGIN to add comments