in reply to path greping

Sure enough talexb, here's a File::Find version :)
use File::Find; find(\&wanted, '/clear/pp_00/ngbb'); sub wanted { next unless m|\.txt\z|is; if ($File::Find::name =~ m|/clear/pp_00/ngbb/([^/\\]+?)[/\\].*|) { print "the someName dir is $1\n"; } }
Update: As Arien pointed out, my regex was a bit off in matching .txt extensions, and just in case a file came in as .TXT I added the 'i' after the regex as well

ryddler

Replies are listed 'Best First'.
Re(2): path greping
by Arien (Pilgrim) on Aug 29, 2002 at 22:35 UTC
    next unless m|^.*.txt\z|s;

    According to this regex a filename without extension with at least 4 characters ending in txt matches. To match .txt files:

    next unless /\.txt\z/s;

    To find out the directory your are looking at, use $File::Find::dir.

    — Arien