1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-14 10:45:06 +02:00

[perl/en] more perlish iterations on perl5 (#2489)

* more perlish iteration

c-style 'for' isn't perlish

* Update perl.html.markdown

removed one of the array iterator loops
This commit is contained in:
Chris C
2017-02-09 09:31:22 -06:00
committed by ven
parent 4e6d077556
commit 447986c19d

View File

@@ -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) {