|
|
foreach statement in perl - Perl
|
Views : 268
|
|
Tagged in : Perl
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
foreach statement in perl
This statement takes a list of values and assigns them one at a time to a scalar variable. Each time executing a block of code.
foreach $i (@some_list) {
statement1;
statement2;
}
The following example takes in element and mutliples it by 3 and replaces the original values in the array.
@a = (3, 5, 7,9);
foreach $one (@a) {
$one *= 3;
}
@a now equals = 9, 15, 21, 27
|
|
By Geethalakshmi, On - 2010-09-17 |
|
|
|