http://qs321.pair.com?node_id=688096


in reply to List directory(s)

What do you *really* want to do? What's the purpose? Maybe there's a better version than the simplistic approach:

... my $filename = '/usr/local/bin/perl'; # get tree parts my @parts = $filename =~ m{ [^/]+ (?=/) }xg; # build tree for my $p (0 .. $#parts) { printf "%d. /%s/\n", 1+$p, join('/', @parts[0..$p]) } ...

Regards

mwa