Wow... looks like some good replies to this one. Here's a less elegant, recursive approach (until I learn map :-)
#!perl -w # print all 720 permutations using letters: e m v q g n use strict; sub mutate { my ($in) = @_; if (length($in) == 6) { print "$in\n"; $in = ''; } else { foreach (qw/e m v q g n/) { if ($in =~ /$_/) { #do nothing; } else { print mutate($in . $_); } } } } print mutate(''); #THE END If you're going the other way (trying to see if a known string is valid), something like this ought to work: if (length($a) == 6 and $a =~ /e/ and $a =~ /m/ and $a =~ /v/ [... et al ...] ) { #it's valid } It figures TMTOWTDI. Hope this helps :-) Charlie ----- Original Message ----- From: "Dax T. Games" <[EMAIL PROTECTED]> To: "Perl Users" <[EMAIL PROTECTED]> Sent: Tuesday, September 02, 2003 12:26 PM Subject: Regex Help Needed I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --. Right now this is what I am doing but it is very ugly and difficult to come up with the combinations and it makes my brain hurt!: if ($LS_Val =~ /-{1,2}(mevqgn| emvqgn|evmqgn|evqmgn|evqgmn|evqgnm| veqgnm|vqegnm|vqgenm|vqgnem|vagnme| qvgnme|qgvnme|qgnvme|qgnmve|qgnmev| gqmnev|gmqnev|gmnqev|gmneqv|gmnevq| mgnevq|mngevq|mnegvq|mnevgq|mnevqg| nmevqg|nemvqg|nevmqg|nevqmg|nevqgm| envqgm|evnqgm|evqngm|evqgnm|evqgmn| )/i) { #Do Something; } A subroutine that takes the string of characters as an argument and then returns 1 on success and undef on fail would be ideal for my purpose. Any help is appreciated. Dax _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs