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

Reply via email to