No. In fact, I hadn't even thought about the general case in which glob metacharacters may be included in the input string, i.e., the string to be permuted (if that's what you're referring to).

Ferinstance, consider the input string 'Prefix{u,v}2={w,x}:b,{y,z}:1,2'. An attempt to fix this up so that glob produces

Prefix{u,v}2={w,x}:b:1 Prefix{u,v}2={w,x}:{y,z}:1 Prefix{u,v}2={w,x}:b:2 Prefix{u,v}2={w,x}:{y,z}:2
shows that there's a problem with the  , metacharacter: I can't figure out how to metaquote it.
c:\@Work\Perl\monks\NorthernFox>perl -wMstrict -MData::Dump -le "my @proto_globules = ( 'Prefix{u,v}2={w,x}:b,{y,z}:1,2', ); ;; my $rx_comma_in_curlies = qr{ { .*? , .*? } }xms; ;; my $rx_globmeta = qr{ [\[\]{}*?~] }xms; ;; my %globize = ('=' => '={', ':' => '}:{', '' => '}'); ;; for my $globule (@proto_globules) { print qq{A: '$globule'}; $globule =~ s{ ($rx_comma_in_curlies) } { (my $r = $1) =~ s{,}{\\,}xmsg; $r; }xmsge; $globule =~ s{ (?= $rx_globmeta) }{\\}xmsg; print qq{B: '$globule'}; $globule =~ s{ ([=:] | \z) } { print qq{S: '$1'}; $globize{$1}; }xmsge; print qq{C: '$globule'}; my @globs = glob $globule; dd 'DD:', \@globs; print ''; next; } " A: 'Prefix{u,v}2={w,x}:b,{y,z}:1,2' B: 'Prefix\{u\,v\}2=\{w\,x\}:b,\{y\,z\}:1,2' S: '=' S: ':' S: ':' S: '' C: 'Prefix\{u\,v\}2={\{w\,x\}}:{b,\{y\,z\}}:{1,2}' ( "DD:", [ "Prefix{u\\,v}2={w\\:b:1", "Prefix{u\\,v}2={w\\:b:2", "Prefix{u\\,v}2={w\\:{y\\:1", "Prefix{u\\,v}2={w\\:{y\\:2", "Prefix{u\\,v}2={w\\:z}:1", "Prefix{u\\,v}2={w\\:z}:2", "Prefix{u\\,v}2=x}:b:1", "Prefix{u\\,v}2=x}:b:2", "Prefix{u\\,v}2=x}:{y\\:1", "Prefix{u\\,v}2=x}:{y\\:2", "Prefix{u\\,v}2=x}:z}:1", "Prefix{u\\,v}2=x}:z}:2", ], )
The  \{u\,v\} isn't too bad, but wrapping a pair of  { } permuting curlies around  \{w\,x\} or  b,\{y\,z\} reveals that the comma is still "active":
still active! -------+------------+ | | v v C: 'Prefix\{u\,v\}2={\{w\,x\}}:{b,\{y\,z\}}:{1,2}' ^ ^ ^ ^ | | | | in added curlies --+--------+-+----------+
So unless someone can figure out how to metaquote the glob comma-in-curlies operator, it looks like a parser of some kind is the way to go in the general case.


Give a man a fish:  <%-{-{-{-<


In reply to Re^5: Combinations of lists, etc by AnomalousMonk
in thread Combinations of lists to a hash by tel2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.