http://qs321.pair.com?node_id=109201


in reply to Sorting strings

++hofmator,++ducky... I now understand how map works. My next problem is this: map  {$_->[0]}. I know that map is operating on $_[0] (I think) but what is this: ->[0] ???. I read the FMTEYEWTK, and while Mr. Christiansen does a good job explaining, I must admit that I would rather have read a more exhaustive dissertation with more examples of what @alist, $a, @blist, $b, etc.. were set to. I found that I could understand some of the things Tom was explaining, and on others I just got lost in the code without knowing what the values of the variables he was operting in were. I guess I'm thinking very rigidly, because I can understand this:
@single = 1..10; @treble = map { $_ * 3 } @single; foreach (@treble) { print $_." "; } print "\n";
<rant>
I can follow EXACTLY what's happening in that code snippet, because I know what @single is equal to each time the map function iterates over one of the values. The output is as follows:
3 6 9 12 15 18 21 24 27 30
However, when I tried following the code examples in FMTEYEWTK, I had a horrible time understanding what he was trying to convey. I know I won't know everything the moment I read it, and I intend to read FMTEYEWTK a few more times, but I have to say I'm a bit frustrated. I do know this: I'm not giving up. I might not understand this today, or tomorrow, but I will at some point.
</rant>
If anybody would like to take a shot at helping me understand, I would appreciate it GREATLY. Hopefully I can pass this (or other) knowledge along to someone else someday.
TIA
-spartan

Very funny Scotty... Now PLEASE beam down my PANTS!