http://www.perlmonks.org?node_id=583170


in reply to process array with while loop

There are also other alternatives for foreach. My preferred one is map:

@array = qw(blue red orange brown); map print, @array;

map allows you to work loops as mathematical application (or functions), and this is the closest approach to my world model.

UPDATE:Many thanks to ww, ikegami, merlyn for their comments and corrections.