Perl loops- foreach Loop - Perl Scripting

What is Perl foreach loop? What is its function?

The foreach loop iterates over a list value and sets the control variable (var) to be each element of the list in turn −


The syntax of a foreach loop in Perl programming language is −

Flow Diagram



When the above code is executed, it produces the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Perl Scripting Topics