Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^8: using hashes

by R56 (Acolyte)
on Sep 27, 2013 at 17:48 UTC ( #1056050=note: print w/replies, xml ) Need Help??

in reply to Re^7: using hashes
in thread iterating hash keys?

Imagine these values:

banana => 25

bana => 20

bana-na => 15

na => 10

For the translation to, let's say:


Currently the output is:


That's what made me thought the hyphens were a special case...

Replies are listed 'Best First'.
Re^9: using hashes
by kennethk (Abbot) on Sep 27, 2013 at 21:26 UTC

    No, but they are being marked as word boundaries, and so they pass the regex I gave before. For the situation you've described, the only obvious solution I can see is to traverse the key list from long to short as I've shown in Re^5: using hashes. Things get messy with replacement lists when your keys are not independent.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      I see... Thanks again!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2016-10-22 06:36 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (292 votes). Check out past polls.