in reply to path greping

I must see this kind of question every week. Why try to be infinitely clever using a regular expression? Just let split do the work.
system("find /clear/pp_00/ngbb/ -name '*.txt' > CCfiles"); open (OUT , "CCfiles" ) or die " can't open CCfiles\n"; while (<OUT>) { # Original code # $_ =~ m/^//\w+////; # print "the someName dir is $_\n"; my @Result = split ( /\//, $_ ); print "the someName dir is $Result[1]\n"; }
No doubt there will also be Monks suggesting you use the File::Find module instead -- it's a cleaner solution to running a command through system() to get the directory scan results you want.

--t. alex
but my friends call me T.

Update: My 300th node! Thanks everyone!!

Replies are listed 'Best First'.
Re: Re: path greping
by grep (Monsignor) on Aug 30, 2002 at 03:38 UTC
    For a more OS independant solution than split I explain a way to use File::Basename in this node

    grep
    Mynd you, mønk bites Kan be pretti nasti...