Hi,

This is indeed much faster, just substitute the last directory off of the path
when you're done checking with the current.
Looks better indeed !!

Nikola, 
using File::find searches all the files and as the directory's can hold many
files and directory's I prefer to just do the test on 1 file.
But I know File::Find and it is very usefull !! Thanks for your help !

I understand the command "last" just tells the foreach loop to quit when done.
Looks realy good !!

Thanks !!

David
-------------------
> > 
> > 
> > 
> > Hi,
> > 
> > I am looking for a nice solution for the following problem :
> > 
> > I have a directory stored in $header. I need to seek each 
> > directory for a specific
> > file, but I have to start in the deepest dir and than go 
> > upwards.
> 
> All that splitting and reversing seems complicated. Why not
> just a simple loop that snips off the last part of the path
> each time around? Something like this:
> 
>     #!/usr/bin/perl
> 
>     use strict;
> 
>     my $path = '/usr/local/bin';
>     my $file = 'foo';
> 
>     while ($path) {
>         print "Checking $path\n";
>         print("Found $path/$file!\n"), last if -e "$path/$file";
>         $path =~ s!/[^/]*\z!!;
>     }
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to