Here's what I found for why one would want to use one method over the other:
http://stackoverflow.com/questions/1506801/what-reasons-are-there-to-prefer-glob-over-readdir-or-vice-versa-in-perl In my case, I wanted every entry except '.' and '..', so readdir made sense. Paul On Sat, May 9, 2015 at 4:09 PM, Curt Lundgren <[email protected]> wrote: > If I want all the files in a directory I'd do: > > my @files = glob( "/path/to/directory/*" ); > > Works every time for me. > > On Sat, May 9, 2015 at 3:55 PM, Paul Boniol <[email protected]> wrote: > >> Not sure what you mean exactly by doing a glob on those directories. >> >> If you mean something like looking for plain files beginning with 'abc', >> I think you have to do a readdir and something like a >> next unless ($_ =~ m/^abc/); >> next unless (-f $_); >> >> Paul >> >> On Sat, May 9, 2015 at 3:02 PM, Curt Lundgren <[email protected]> wrote: >> >>> I love it when I learn something new - never saw opendir or its related >>> commands before. >>> >>> I'm curious, can you do a glob on those directories? >>> >>> On Sat, May 9, 2015 at 2:34 PM, Paul Boniol <[email protected]> >>> wrote: >>> >>>> / ok >>>> /cygdrive - Fails >>>> /cygdrive/c fails >>>> /home Fails >>>> /home/paul Fails >>>> . Ok >>>> >>>> Paul >>>> On May 9, 2015 2:22 PM, "Tilghman Lesher" <[email protected]> wrote: >>>> >>>>> Can you do an opendir on something higher in the chain? I'd suggest >>>>> something along the lines of "/cygdrive/c", or something like that, to >>>>> see if the problem is the opendir command itself, or if it's something >>>>> higher. For that matter, can you do an opendir on "/"? >>>>> >>>>> On Sat, May 9, 2015 at 2:06 PM, Paul Boniol <[email protected]> >>>>> wrote: >>>>> > I'm sure this is a SMDH moment... but I have a Perl program that >>>>> does an >>>>> > opendir to get the list of files. Been running fine for years under >>>>> Cygwin. >>>>> > I just installed Cygwin64. Tried to run it. opendir fails with "No >>>>> such >>>>> > file or directory". >>>>> > >>>>> > Doing a command line ls same-dir-path works fine. >>>>> > >>>>> > It is outside C:\Cygwin64\ so the path is a >>>>> /cygdrive/c/some/other/dir/.... >>>>> > but that shouldn't matter. (Also tried from a symbolic link) >>>>> > >>>>> > I'm sure it is something I'm doing wrong, but this is so simple, I >>>>> don't >>>>> > know what I could be doing wrong, or failing to check. Any thoughts? >>>>> > >>>>> > Paul >>>>> > >>>>> > -- >>>>> > -- >>>>> > You received this message because you are subscribed to the Google >>>>> Groups >>>>> > "NLUG" group. >>>>> > To post to this group, send email to [email protected] >>>>> > To unsubscribe from this group, send email to >>>>> > [email protected] >>>>> > For more options, visit this group at >>>>> > http://groups.google.com/group/nlug-talk?hl=en >>>>> > >>>>> > --- >>>>> > You received this message because you are subscribed to the Google >>>>> Groups >>>>> > "NLUG" group. >>>>> > To unsubscribe from this group and stop receiving emails from it, >>>>> send an >>>>> > email to [email protected]. >>>>> > For more options, visit https://groups.google.com/d/optout. >>>>> >>>>> >>>>> >>>>> -- >>>>> Tilghman >>>>> >>>>> -- >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "NLUG" group. >>>>> To post to this group, send email to [email protected] >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/nlug-talk?hl=en >>>>> >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "NLUG" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "NLUG" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/nlug-talk?hl=en >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "NLUG" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "NLUG" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nlug-talk?hl=en >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "NLUG" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> -- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nlug-talk?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "NLUG" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > -- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nlug-talk?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "NLUG" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en --- You received this message because you are subscribed to the Google Groups "NLUG" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
