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

Re: upper-lower case combinatorics

by Aristotle (Chancellor)
on Dec 24, 2004 at 02:56 UTC ( [id://417240]=note: print w/replies, xml ) Need Help??


in reply to upper-lower case combinatorics

Neat trick, though it won't handle very long strings. (What's with the indentation btw?)

Here's a non-tricky solution:

use Set::CrossProduct; sub casify { my @letters = map [ uc $_, lc $_ ], split //, $_[ 0 ]; return( map join( '', @$_ ), Set::CrossProduct->new( \@letters )->combinations; ); }

:-) Of course, it runs much slower, in case that really is a concern…

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-23 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found