Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I have to fill 3 slots
slot1 can be filled with 'a' or 'b'
slot2 can be filled with 'x','y' or 'z'
slot3 can be filles with 'p','q', 'r' or 's'
 

So the valid combinations are
axp axq axr axs
ayp ayq ayr  ays
bxp bxq ... and so on


How can I generate all such combinations


What I have tried:

I have tried a perl code like

@p = qw (ab xyz pqrs )
foreach (@p) {
$l = ... ( I am not sure what to do next )
}
Posted
Updated 20-Apr-16 23:06pm

1 solution

Try some research: perl split string - Google Search[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900