in reply to List directory(s)

Anonymous Monk:

(Jumpin' Jiminy--you sure post a lot!)

Here's another way to do it. (I just saw your question, and thought I'd try array slices to do the job.)

#!/usr/bin/perl -w use strict; use warnings; my $fname = '/usr/local/bin/perl'; my @fname_parts = split /\//, $fname; # Start at 1 to skip blank directory part (chunk before /usr), # and @fname_parts-2 to leave off the final chunk (program name) for my $i (1 .. @fname_parts-2) { print "$i. ", join('/', @fname_parts[0..$i]), "\n"; }
...roboticus