No shell is involved. If you strace perl (strace -f -ff on linux), you'll see that no shell is spawned.

AFAIK perl now uses File::Glob internally1, and in fact foo.pl as

$a=q|a\ \\\{bc.d/*|;print "pattern <", $a, "> globs to <", (glob $a), +">\n"; print "$_\n" for sort keys %INC;

yields

pattern <a\ \\{bc.d/*> globs to <a {bc.d/GOT ITabcde> Carp.pm Exporter.pm File/Glob.pm Text/ParseWords.pm XSLoader.pm strict.pm vars.pm warnings.pm warnings/register.pm

while running

$a=q|a\{bc.d/*|;print "pattern <", $a, "> globs to <", (glob $a), ">\n +"; print "$_\n" for sort keys %INC;

results in

pattern <a\{bc.d/*> globs to <a{bc.d/GOT ITabcde> File/Glob.pm XSLoader.pm strict.pm

I suspect a subtlety (bug?) in Text::ParseWords or its usage. The behaviour you describe (which I confirm for my systems) looks like a two-pass parsing whenever a whitespace is present - in that case the \{ seems to get "optimized away" (running with -Dcr):

Guessing start of match, REx "\\(.)" against "\{bc.d/*"... Found anchored substr "\" at offset 0... Guessed: match at offset 0 Matching REx "\\(.)" against "\{bc.d/*" Setting an EVAL scope, savestack=56 0 <> <\{bc.d/*> | 1: EXACT <\\> 1 <\> <{bc.d/*> | 3: OPEN1 1 <\> <{bc.d/*> | 5: SANY 2 <\{> <bc.d/*> | 6: CLOSE1 2 <\{> <bc.d/*> | 8: END Match successful! Guessing start of match, REx "\\(.)" against "bc.d/*"... Did not find anchored substr "\"... Match rejected by optimizer Not present... Match failed

No time to track that down rigth now... smells like eval involved.

1) From doio.c:

=head1 IO Functions =for apidoc start_glob Function called by C<do_readline> to spawn a glob (or do the glob insi +de perl on VMS). This code used to be inline, but now perl uses C<File::G +lob> this glob starter is only used by miniperl during the build process. Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl u +p. =cut */ PerlIO * Perl_start_glob (pTHX_ SV *tmpglob, IO *io)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: glob with special characters by shmem
in thread glob with special characters by Hue-Bond

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.