Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: get it into one line ?

by repson (Chaplain)
on Apr 16, 2001 at 14:40 UTC ( #72798=note: print w/ replies, xml ) Need Help??


in reply to get it into one line ?

You could do it like this:
$newsecret = do { my %hash; join('', map { $hash{$_}++ ? () : $_ } (split //, $secret)); }; The do creates a new scope so that the hash isn't in scope outside the area it is needed.
However I would probably use a regex like athomason's above.


Comment on Re: get it into one line ?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-12-27 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls