newperl has asked for the wisdom of the Perl Monks concerning the following question:
@names = qw/ fred betty barney dino wilma peblles bamm-bamm /; chomp(@list = <STDIN>); foreach (@list) { print "$names[ $_ - 1 ]\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A simple foreach question
by davido (Cardinal) on Mar 06, 2005 at 06:44 UTC | |
|
Re: A simple foreach question
by rlb3 (Deacon) on Mar 06, 2005 at 06:43 UTC | |
by betterworld (Curate) on Mar 06, 2005 at 16:55 UTC | |
|
Re: A simple foreach question
by chas (Priest) on Mar 06, 2005 at 06:43 UTC | |
|
Re: A simple foreach question
by runrig (Abbot) on Mar 06, 2005 at 06:49 UTC | |
|
Re: A simple foreach question
by calin (Deacon) on Mar 06, 2005 at 11:23 UTC | |
|
Re: A simple foreach question
by davidj (Priest) on Mar 06, 2005 at 06:53 UTC | |
|
Re: A simple foreach question
by gopalr (Priest) on Mar 06, 2005 at 06:53 UTC |