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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: process array with while loop
by blahblah (Friar) on Nov 09, 2006 at 18:27 UTC | |
by shawnhcorey (Friar) on Nov 10, 2006 at 15:39 UTC | |
by davorg (Chancellor) on Nov 14, 2006 at 14:04 UTC | |
Re^2: process array with while loop
by chromatic (Archbishop) on Nov 09, 2006 at 19:37 UTC | |
by monsieur_champs (Curate) on Nov 14, 2006 at 13:53 UTC |
In Section
Seekers of Perl Wisdom