use File::Find and turn on the option 'bydepth';

http://search.cpan.org/doc/GSAR/perl-5.6.1-TRIAL3/lib/File/Find.pm

> -----Original Message-----
> From: David vd Geer Inhuur tbv IPlib
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 04, 2002 9:05 AM
> To: [EMAIL PROTECTED]
> Subject: skip first array entry and exit foreach loop only
> 
> 
> 
> 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. Using the split
> @header first value is always empty as it is splitting on " 
> */*". As /user does not
> contain any data in front of the / I have a "problem".
> Of course I can do the "if (!($head)) { next; } ", but I hope 
> there is a more
> beautifull solution. Any ideas ??
> 
> Also ones I found the file I need to find, I would like to 
> exit out of the 
> foreach loop only. How do I do ??
> The example is below. Thanks for your help in advance !!
> 
> Regs David
> #----------------
> 
> $header = "/someone/I/know";
> 
> sub pre {
> 
> @header = split(/\//, $header);
> chomp @header;
> $dm = "/user/IPlib";
> 
>   foreach $head(@header) {
>     #if (!($head)) { next; }   ??
>     $dm = "$dm" . "/$head";
>     push @dv, $dm;
>     @rdv = reverse(@dv);
>   } # End foreach 
>   
>   foreach $rdv(@rdv) {
>     if ( -f "${rdv}/feature.tmpl" ) {
>       open (FH "< ${rdv}/feature.tmpl");
>       @template = <FH>;
>       close FH;
>       ## ?? Exit out of this foreach loop only ??
>     } # End-if
>     else { next; }
>     
> } # End sub pre
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to