Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Perl/Basics/Loops/For Each"
From NetSec
AlizaLorenzo (Talk | contribs) (Created page with "* A foreach loop is built specifically for array handling and iterates through all of the elements in an array. {{code|text=<source lang="perl">my @messages = ("Hello world!\n","...") |
(No difference)
|
Latest revision as of 02:59, 16 July 2012
- A foreach loop is built specifically for array handling and iterates through all of the elements in an array.
my @messages = ("Hello world!\n","I like perl!\n"); foreach my $message (@messages) { print $message; } |
The above code will iterate through every element in an array.