glob doesn't take paths, glob takes patterns, and back slashes escape glob meta characters
$ perl -le"print for glob shift" C:\perl\[5]*\bin $ perl -le"print for glob shift" C:\perl\\[5]*\bin C:\perl\5.10.1\bin C:\perl\5.11.1\bin C:\perl\5.12.2\bin $ perl -le"print for glob shift" C:\perl/[5]*\bin C:\perl/5.10.1\bin C:\perl/5.11.1\bin C:\perl/5.12.2\bin
So you need to escape $path_to_dir according to your glob rules or
chdir $path_to_dir ; glob '*.type';
I think glob is neat, but the syntax can get complicated , after all it is a shell mini language, for advanced computer users.

Compare the above example to findrule

$ findrule C:\perl -directory -name ( bin ) C:\perl/5.10.1/bin C:\perl/5.10.1/html/bin C:\perl/5.11.1/bin C:\perl/5.12.2/bin C:\perl/site/5.12.2/bin
I didn't want site or html bin, so trying to fix that
$ findrule C:\perl -directory -name ( bin ) -maxdepth 1 $ findrule C:\perl -directory -name ( bin ) -maxdepth 2 C:\perl/5.10.1/bin C:\perl/5.11.1/bin C:\perl/5.12.2/bin $ perl -MFile::Find::Rule -le"print for File::Find::Rule->new ->direct +ory ->name('bin') ->maxdepth(2) ->in('C:\perl') " C:\perl/5.10.1/bin C:\perl/5.11.1/bin C:\perl/5.12.2/bin
findrule can be adequate, but its not as compact as glob.
$ perl -le"print for glob shift " C:/perl/*/*/*/perl5*exe C:/perl/5.10.1/bin/MSWin32-x86-multi-thread/perl5.10.1.exe C:/perl/5.11.1/bin/MSWin32-x86-multi-thread/perl5.11.1.exe C:/perl/5.12.2/bin/MSWin32-x86-multi-thread/perl5.12.2.exe

In reply to Re: Globbing uncertainty by Anonymous Monk
in thread Globbing uncertainty by Anonymous Monk

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.