perlnewb00
Programmer
I need to list all folders in a current dirctory non-recursivly and print the last modified date for that folder. I found a script that works but I need it written in such a way I can perform other actions if a folder is found. I am not very used to this method of if-then-else and would prefer it written in this format
if(found){
process
}else next
This is the current script:
my $dir = '\mydir;
opendir my $dh, $dir or die "Cannot open '$dir' $!";
print "$dir \n",
map !/\A\.\.?\z/ && -d "$dir/$_" ? "$dir/$_ ".ctime(stat("\mydir\$_")->mtime)." \n" : (),
readdir $dh;
if(found){
process
}else next
This is the current script:
my $dir = '\mydir;
opendir my $dh, $dir or die "Cannot open '$dir' $!";
print "$dir \n",
map !/\A\.\.?\z/ && -d "$dir/$_" ? "$dir/$_ ".ctime(stat("\mydir\$_")->mtime)." \n" : (),
readdir $dh;