Perl Monk, Perl Meditation | |
PerlMonks |
Re: Re: Back to Remedial Perl for Me: map{} functionby mikfire (Deacon) |
on Dec 15, 2000 at 20:34 UTC ( [id://46841]=note: print w/replies, xml ) | Need Help?? |
Sorry, merlyn, but the second example *is* turning a list
into another list. map is very capable of mapping 1-to-n
relations, ie, every element on the right will produce more
than one element on the right.
If I read your statement correctly ( and I may not have ), the first use of map isn't correct But this usage is correct
How else is map supposed to make @first into @second except by performing an action on every element of @first? I am not arguing that a foreach wouldn't be appropriate here. If that is what works, by all means use it. But if I am not supposed to use map when I want an action on every element of an array, doesn't it make more sense to say because that seems to be the only option you have left me with this statement. Would you be kind enough to expand on your answer so I can figure out what I missed?
TIA
In Section
Seekers of Perl Wisdom
|
|