++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!

In reply to Re: Sorting strings by spartan
in thread Sorting strings by rbi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.