Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] double-regexp necessary?

Expand Messages
  • Paul Archer
    ... Thanks. I think I ll probably start with the substitutions...although I may try the hash-of-hashes at some point, since I do want to replace the actual
    Message 1 of 2 , Feb 26, 2004
    • 0 Attachment
      7:48pm, zsdc wrote:

      > Paul Archer wrote:
      >
      > > The question is--well, the first question really is: does anyone know of
      > > some prebuilt code to do this kind of layout? I'd rather not reinvent the
      > > wheel.
      > > But other than that, the question is, what's the easiest way to do the
      > > transformations on my list? I know I need to leave the base directory name
      > > alone, replace its parent with an arrow, and replace any path elements above
      > > that with a tab (or whatever). But is there any way to do that with a single
      > > substitute operator? Or should I be looking at something like a 'map', or
      > > even 'split'ting the path and working on individual elements?
      >
      > You can start from something like this filter:
      >
      > #!/usr/bin/perl -wpl
      > s!([^/]+$)!|_>$1!;
      > s!.*?/! !g;
      > __END__
      >
      > (it parses the list of directories on standard input) and tune the
      > substitutions to your needs. You might also build a tree of hashes
      > (something in the lines of $hash{images}{dir1}{subdirA}, etc.) from your
      > directories and work on it if you need some more control. You could
      > print such a tree using Data::Dumper. See:
      >
      > http://search.cpan.org/search%3fmodule=Data::Dumper
      >

      Thanks. I think I'll probably start with the substitutions...although I may
      try the hash-of-hashes at some point, since I do want to replace the actual
      directory names with descriptions.

      paul
    Your message has been successfully submitted and would be delivered to recipients shortly.