in reply to Problem stripping directory listing
Here are a couple of ways to do it. With perl you dont need to shell out very much as most of the standard shell utilities are available in pure Perl. opendir readdir grep map and glob are all handy
#/usr/bin/perl opendir DIR, "$ARGV[0]/users" or die $!; @dirs = grep { -d "$ARGV[0]/users/$_" and not /^\./ }readdir DIR; print "$_\n" for @dirs; #/usr/bin/perl @fullpath = grep { -d and not /^\./ } glob "$ARGV[0]/users/*"; @dirs = map { s!\Q$ARVG[0]\E/users/!!; $_ } @fullpath print "$_\n" for @dirs;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|