Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Question: best way to sort an hash of hashes

Expand Messages
  • Jenda Krynicky
    From: Prasanna Goupal ... I didn t read your mail but from your mail s subject, please use the following Is it really so hard to
    Message 1 of 9 , Jul 26, 2005
    • 0 Attachment
      From: Prasanna Goupal <perl_developer@...>
      > I dont read ur mail but from ur subject (mail), please use folowing

      I didn't read your mail but from your mail's subject, please use the
      following

      Is it really so hard to refrain from using those silly shortcuts? Do
      U think UR mail would take longer to write?

      And replying to a query without reading the text and going by what
      you think the person could have meant by the subject is very seldom
      helpful to anyone.

      !post top not do please And

      Thanks, Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    • Bob Alexander
      ... WOW ! Thanks a lot Japhy. I will spend some of my free time studying your code and after reading it along with the perldoc help I might even learn
      Message 2 of 9 , Jul 26, 2005
      • 0 Attachment
        Jeff 'japhy' Pinyan wrote:
        > Finally, although this might be a bit much for you, you can chain those
        > two statements together to create your desired data structure in one go.
        > This type of mechanism should be read bottom-to-top; that is, first
        > values(%log), then the map(), and then the sort().
        >
        > my @flat =
        > sort {
        > ($a->[0] <=> $b->[0]) or
        > ($a->[2] cmp $b->[2]) or
        > ($a->[1] <=> $b->[1])
        > } map [@$_{'logintime', 'logouttime', 'username'}],
        > values %log;
        >

        WOW !

        Thanks a lot Japhy.

        I will spend some of my free time studying your code and after reading
        it along with the perldoc help I might even learn something :) !!!

        BTW suppose I want to understand how the sort function really works. If
        I give perldoc sort but this is not what I want. perldoc perlfunc is
        what I need but to a beginner like me the descriptio although extremely
        precise is a bit obscure. What are more beginner friendly sources other
        than printed books which I could download and keep on my portable since
        I am not connected too often :(
      • Jeff 'japhy' Pinyan
        ... You re very welcome. ... Heheh. I d suggest looking at http://learn.perl.org/ too. ... Offhand, I can t really think of many beginner-level resources out
        Message 3 of 9 , Jul 26, 2005
        • 0 Attachment
          On Jul 26, Bob Alexander said:

          > Jeff 'japhy' Pinyan wrote:
          > > Finally, although this might be a bit much for you, you can chain those
          >> two statements together to create your desired data structure in one go.
          >> This type of mechanism should be read bottom-to-top; that is, first
          >> values(%log), then the map(), and then the sort().
          >>
          >> my @flat =
          >> sort {
          >> ($a->[0] <=> $b->[0]) or
          >> ($a->[2] cmp $b->[2]) or
          >> ($a->[1] <=> $b->[1])
          >> } map [@$_{'logintime', 'logouttime', 'username'}],
          >> values %log;
          >
          > WOW !
          >
          > Thanks a lot Japhy.

          You're very welcome.

          > I will spend some of my free time studying your code and after reading
          > it along with the perldoc help I might even learn something :) !!!

          Heheh. I'd suggest looking at http://learn.perl.org/ too.

          > BTW suppose I want to understand how the sort function really works. If
          > I give perldoc sort but this is not what I want. perldoc perlfunc is
          > what I need but to a beginner like me the descriptio although extremely
          > precise is a bit obscure. What are more beginner friendly sources other
          > than printed books which I could download and keep on my portable since

          Offhand, I can't really think of many beginner-level resources out there,
          but that's because I haven't used them in such a long time. ;) I'd guess
          learn.perl.org has some good links.

          --
          Jeff "japhy" Pinyan % How can we ever be the sold short or
          RPI Acacia Brother #734 % the cheated, we who for every service
          http://japhy.perlmonk.org/ % have long ago been overpaid?
          http://www.perlmonks.org/ % -- Meister Eckhart
        Your message has been successfully submitted and would be delivered to recipients shortly.