summaryrefslogtreecommitdiffhomepage
path: root/perl.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'perl.html.markdown')
-rw-r--r--perl.html.markdown8
1 files changed, 3 insertions, 5 deletions
diff --git a/perl.html.markdown b/perl.html.markdown
index a29fdf1f..93eabea9 100644
--- a/perl.html.markdown
+++ b/perl.html.markdown
@@ -138,18 +138,16 @@ while (condition) {
# for loops and iteration
-for (my $i = 0; $i < $max; $i++) {
+for my $i (0 .. $max) {
print "index is $i";
}
-for (my $i = 0; $i < @elements; $i++) {
- print "Current element is " . $elements[$i];
-}
-
for my $element (@elements) {
print $element;
}
+map {print} @elements;
+
# implicitly
for (@elements) {