Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^8: File:Find pattern match question

by RockE (Novice)
on Nov 03, 2013 at 11:52 UTC ( [id://1061036]=note: print w/replies, xml ) Need Help??


in reply to Re^7: File:Find pattern match question
in thread File:Find pattern match question

Hi Ken Thanks for your reply. Changing the sub routine to this

sub dir_names { return unless -d; return unless /[IPD]\d{8}$/; $dirs{$File::Find::name} = 1; ++$dirs{$File::Find::name}; }
Gives me this
C:\Temp\hddzip>perl dirpathdupes.pl C:\Temp/Alcohol/P12345678 C:\Temp/I12345678 C:\Temp/P12345678 C:\Temp/harddrives/P12345678 C:\Temp/hddzip/P12345678
Which seems fine as its showing all instances of the P00# but I only have one directory starting with I00#, so by all rights it should not display it if I'm seaching for dupes. Adding another P00# directory P12345677 also displays, so it seems it is still just showing directories matching "return unless /IPD\d{8}$/;"

Replies are listed 'Best First'.
Re^9: File:Find pattern match question
by kcott (Archbishop) on Nov 13, 2013 at 16:44 UTC

    Every time you call dir_names(), you set $dirs{$File::Find::name} to 1, then you increment it.

    $dirs{$File::Find::name} will equal 2 after every call to dir_names()!

    -- Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1061036]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found