![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Back to Remedial Perl for Me: map{} functionby jreades (Friar) |
on Dec 15, 2000 at 20:10 UTC ( #46832=perlquestion: print w/replies, xml ) | Need Help?? |
jreades has asked for the wisdom of the Perl Monks concerning the following question: While understanding what map{} is supposed to do, I seem to be consistently unable to use it correctly... which suggests that, on some level I really don't know what it actually does. As I understand it, map{} applies some function (defined within the BLOCK) to each element of an array and the result is passed to the left. So, you could, for instance, write a for loop without using a for simply by writing:
But what about more complicated statements? I make it about as far as loading a hash from an array that I've split before it all starts to look like a monkey hitting the keys largely at random.
Why, for instance, could I not work this through even though it's clearly a mapping situation?
I guess what I'm seeking is the wisdom to understand how map operates within the BLOCK since most mentions of the map{} function are either cryptic or basic and I fall somewhere in between. TIA
Back to
Seekers of Perl Wisdom
|
|