Thanks, it does exactly what I want!
At least if I strip the leading "/" first, but that's ok, since I have
to prepend the base path to each one anyway.
Great!

On Sun, Mar 30, 2003 at 11:12:35AM +0100, Andy Wardley wrote:
> Kenneth Ekdahl wrote:
> >  2. Can anyone help me with a simple algorithm to take a path, like
> >     this: "/xx/yy/foo/bar", and split it up in an array like this:
> >     ( "/xx/yy/foo/bar", "/xx/yy/foo", "/xx/yy", "/xx" )
> 
> How about something like this:
> 
>   my $path = '/foo/bar/baz/ping/pong';
>   my @path = split('/', $path);
>   my @inc;
> 
>   while (@path) {
>       push @inc, join('/', @path);
>       pop @path;
>   }
> 
> HTH
> 
> A
> 
> 
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://lists.template-toolkit.org/mailman/listinfo/templates

-- 
/*************************************/
/* Kenneth Ekdahl ([EMAIL PROTECTED]) */   
/*************************************/

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to