Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Sorting - lower to upper

by Roy Johnson (Monsignor)
on Jul 15, 2004 at 17:27 UTC ( [id://374737]=note: print w/replies, xml ) Need Help??


in reply to Sorting - lower to upper

@keys = ((sort grep(/^[a-z]/, keys %hash)), (sort grep(/^[A-Z]/, keys +%hash)));

We're not really tightening our belts, it just feels that way because we're getting fatter.

Replies are listed 'Best First'.
•Re^2: Sorting - lower to upper
by merlyn (Sage) on Jul 15, 2004 at 19:14 UTC
    That'll make duplicate copies of everything that doesn't begin with a letter. Maybe you want to narrow those regexen down a bit.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.


    update: Oops, confused [^a-z] with ^[a-z]. So yes, everything without a letter will be absent, not duplicated. Doesn't change that there's something wrong with this solution.
      Seems to me that it should leave out anything that doesn't begin with a letter. Given the specs, that may or may not be desirable.

      We're not really tightening our belts, it just feels that way because we're getting fatter.
      It seems to me that rather than duplicate all non-first-lettered-words (nice hyphenate don't you think?), it actually discards all these words. I mean, the first list sorts all words which start with a small-case and the second list sorts all the first-upper-cased-words.

      I would appreciate explanation.

      Update: It seems that my pertinent and correct remark was voted down at least two times. I wonder what that means.
        It seems that my pertinent and correct remark was voted down at least two times. I wonder what that means.
        It doesn't necessarily mean anything, apart from the fact that there are some jackasses around. Downvotes are the most contentious and least useful feature of PerlMonks.

        We're not really tightening our belts, it just feels that way because we're getting fatter.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://374737]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found