5/13/99, Chilton Webb wrote: >I've been knocking this one around in my miniature brain for about a >month now, so I guess I'm not going to figure it out on my own. > >I have a list of files, with this structure: > ... > >And I want them in this format: > .... > >Any suggestions? Try this... -rkm ---------------------------------------------------------------------------- #!/usr/bin/perl -w use diagnostics; use strict; my @Files = ( 'Macintosh HD:myFiles:a.txt', 'Macintosh HD:myFiles:b.txt', 'Macintosh HD:myFiles:more:a.txt', 'Macintosh HD:myFiles:more:b.txt', 'Macintosh HD:myFiles:more:yetmore:a.txt', 'Macintosh HD:myFiles:more:yetmore:b.txt', 'Macintosh HD:yurFiles:a.txt', 'Macintosh HD:yurFiles:b.txt' ) ; my $CurDir = '' ; foreach my $File (@Files) { my $Depth = ( $File =~ s/:/:/g ) - 1 ; my ( $NewDir, $Base ) = $File =~ /.*?:([^:]*):([^:]*)$/g ; if ( $NewDir ne $CurDir ) { print "\n", " " x $Depth, "$NewDir\n" ; $CurDir = $NewDir } ; print " " x ( $Depth + 1 ), "$Base\n" ; } # Output: # # myFiles # a.txt # b.txt # # more # a.txt # b.txt # # yetmore # a.txt # b.txt # # yurFiles # a.txt # b.txt # ---------------------------------------------------------------------------- ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org