my $dir = '/test/test.pl';
#my $dir = '/test';
sub printdir{
my $dir = shift;
if(-f $dir){
print "$dir\n";
return;
}
if(! -d $dir){
print "this is not a dir\n";
}
opendir(DIR, $dir);
my @dirs = readdir(DIR);
foreach $d (@dirs){
if($d eq '.' || $d eq '..'){
next;
}
$newdir = $dir."/$d";
if(-d $d){
print "$newdir\n";
printdir($newdir);
}else{
print "$newdir\n";
}
}
}
printdir($dir);