Anonymous user
Loops/Foreach: Difference between revisions
m
→{{header|Perl}}
m (→{{header|AWK}}) |
|||
Line 957:
A more compact notation using perl statement modifier:
<lang perl>print "$_\n" foreach @collection</lang>
In perl, it is possible to loop against an explicit list, so there is no need to define a container:
<lang perl>foreach $l ( "apples", "bananas", "cherries" ) {
print "I like $l\n";
}</lang>
=={{header|Perl 6}}==
|