in reply to Re: Combinations of lists, etc
in thread Combinations of lists to a hash
Here's an | another (just saw tybalt89's post) s/// approach to building the globulation string:
Is this any better? (shrugs) (haukex's Building Regex Alternations Dynamically technique might be an interesting general approach to building the s/// pattern, but the curly at the end of the string would present a minor problem.)c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my %globize = ('=' => '={', ':' => '}:{', '' => '}'); ;; my $globule = 'Prefix2=A:b,c:1,2'; $globule =~ s{ ([=:] | \z) }{$globize{$1}}xmsg; print qq{'$globule'}; ;; my @globs = glob $globule; dd \@globs; " 'Prefix2={A}:{b,c}:{1,2}' [ "Prefix2=A:b:1", "Prefix2=A:b:2", "Prefix2=A:c:1", "Prefix2=A:c:2", ]
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Combinations of lists, etc
by tel2 (Pilgrim) on Oct 05, 2019 at 01:22 UTC | |
by AnomalousMonk (Archbishop) on Oct 07, 2019 at 00:15 UTC | |
by tel2 (Pilgrim) on Oct 07, 2019 at 02:13 UTC |