After a bit of experimentation it is the final . character at the end of your filename that is causing the problems. This . is lost by Windows even if you make files by that name with a trailing period char. I had to write my own _glob sub to prove that - it did not work either although it should have. Looking at the filenames from readdir demonstrated the problem. The lost . is the key. You do not really need it anyway as it will match with the * if it was there which it is not.

open F, ">C:/development/project/dev/-71.95_41.0528." or dir $!;close +F; open F, ">C:/development/project/dev/-71.95AAA_41.0528AAA." or dir $!; +close F; open F, ">C:/development/project/dev/-71.95BBB_41.0528BBB." or dir $!; +close F; open F, ">C:/development/project/dev/-71.95CCC_41.0528CCC." or dir $!; +close F; my $fname = "C:/development/project/dev/-71.95*_41.0528*."; my @list = glob($fname); print "I found " . scalar @list . " entries\n"; print "$_\n" for @list; # lose the . at the end - Windows does! my $fname = "C:/development/project/dev/-71.95*_41.0528*"; my @list = glob($fname); print "I found " . scalar @list . " entries\n"; print "$_\n" for @list; # this is how to roll your own glob but you don't need to!!! sub _glob { my($dir,$file) = shift =~ m!^(.*?)([^\\/]+)$!; opendir DIR, $dir or die $!; $file = quotemeta $file; $file =~ s/\\\*/.*/g; $file = qr/$file/; my @files = grep{/$file/}readdir DIR; closedir DIR; $_ = $dir.$_ for @files; return @files; } # here is the output, note the CHANGE to the filenames!!! # You can see we named the "file." but they end up being # called "file" That's Windows for you __END__ I found 0 entries I found 4 entries C:/development/project/dev/-71.95AAA_41.0528AAA C:/development/project/dev/-71.95BBB_41.0528BBB C:/development/project/dev/-71.95_41.0528 C:/development/project/dev/-71.95CCC_41.0528CCC

PS forward slashes / work fine as shown. Perl converts to Windows \ as required. Saves all the \\ stuff.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Glob on Win32: porting 5.005 to 5.6 by tachyon
in thread Glob on Win32: porting 5.005 to 5.6 by perchance

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.