Perl Foreach Loop
# Perl foreach Loop
[ Perl Loops](#)
The Perl foreach loop is used to iterate over the values of a list or collection variable.
### Syntax
The syntax format is as follows:
foreach var (list) {...}
### Flowchart

## Example
#!/usr/bin/perl@list = (2, 12, 36, 42, 51); # Execute foreach loop foreach$a(@list){print"a value is: $an"; }
Executing the above program, the output result is:
a value is: 2 a value is: 12 a value is: 36 a value is: 42 a value is: 51
[ Perl Loops](#)
YouTip