Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

by graff (Chancellor)
on Aug 12, 2007 at 14:24 UTC ( #632057=note: print w/ replies, xml ) Need Help??


in reply to Re: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
in thread Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)

If you don't mind the different order of the output...

... and also don't mind the possible loss of some intended output:

# OP's solution, given a different input: $ perl -le'print $1 while "ZBBBCZZCZ" =~ /((.)\2*)/g' Z BBB C ZZ C Z # jwkrahn's solution for that input: $ perl -le'print for keys %{{"ZBBBCZZCZ" =~ /((.)\2*)/g}}' Z ZZ BBB C
(Not to mention that the OP approach wins at golfing. :)


Comment on Re^2: Yet Another Rosetta Code Problem (Perl, Ruby, Python, Haskell, ...)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-07-22 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (106 votes), past polls