Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Regular expression to list all files of type in folder

by runrig (Abbot)
on Dec 05, 2012 at 21:47 UTC ( #1007408=note: print w/replies, xml ) Need Help??

in reply to Regular expression to list all files of type in folder

Did you put a print "$file\n" before the "next unless" to see if the file even gets returned by readdir?

Also, unless you're using autodie, you should check the status of open and opendir.

Replies are listed 'Best First'.
Re^2: Regular expression to list all files of type in folder
by Phinix (Acolyte) on Dec 05, 2012 at 23:55 UTC

    I skipped the "or die" checks because this is just a quick hack to populate the files I need to include in my PARPacker build list. I agree though this should always be done.

    I just checked on your suggestion and you are right, readdir is the one not picking up the similarly named files, though I have absolutely no idea why.

    There are no strange files present. No file named "0" or any weird symbols (not that it should matter). It is basically just a folder full of a couple hundred .jpg files with simple names.

    I'm using Perl 5.12 so the use in a while loop should be no problem.
      what do you get from

      print join "\t", <$dir/*>

      maybe you confused the path?

      'C:/Some/Random/Folder/tmp/bin' ne "C:\\Some\\Random\\Folder\\perl\\bin\\"

      Cheers Rolf

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007408]
[Corion]: I have no feeling about how my talk was received, but I'm happy with it, which counts the most to me ;-D
[Corion]: Also, London is always a nice visit, as I got to meet a friend there, and spent some time offline, working on "minor" features of the shadertoy thing ;)
[marto]: maybe next year when the kids are a little older I'll have time to attend perl events in Europe
[Corion]: marto: Yeah - there isn't a Perl Day-Care at Perl events - we thought about it for YAPC::Europe 2012 but it's a gigantic effort to organize that

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2016-12-07 09:29 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (125 votes). Check out past polls.