You could regex your input to form a glob pattern:
main::(-e:1): 0 DB<1> x <Prefix1={A,B}:{c,d}> 0 'Prefix1=A:c' 1 'Prefix1=A:d' 2 'Prefix1=B:c' 3 'Prefix1=B:d' DB<2> @keys = <Prefix1={A,B}:{c,d}> DB<3> @hash{@keys} = ('value1') x @keys
> (which I'd rather not bore you with)
That's a bad approach because first it wasn't clear for me what you are trying to achieve.
Especially because %hash = {...} is broken Perl. :)
HTH!
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
A demo to build the glob pattern:
DB<22> ($pre,@comb) = split /=|:/, "Prefix1=A,B:c,d" DB<23> p $pattern = "$pre=" . join ":", map { "{$_}" } @comb Prefix1={A,B}:{c,d} DB<24> x <"$pattern"> 0 'Prefix1=A:c' 1 'Prefix1=A:d' 2 'Prefix1=B:c' 3 'Prefix1=B:d' DB<25>
NB: You should take care to properly escape potential meta characters like * or ?
In reply to Re: Combinations of lists, etc
by LanX
in thread Combinations of lists to a hash
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |