Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: printing all combinations of an array.. (code supplied)by grinder (Bishop) |
on Feb 20, 2002 at 10:00 UTC ( [id://146538]=note: print w/replies, xml ) | Need Help?? |
Here is some code that works very well for me.
There are possibly some minor performance tweaks that could be added, but I have chosen clarity over performance. Hope this helps. Oops, I just re-read your question. You said you wanted combinations of this array, but apparently you also want selections. Oh well, I'm sure you can figure out easily enough how to extend this program to get it to do that too. print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
In Section
Seekers of Perl Wisdom
|
|