My 3th Perl Programm

The current dir show...

CODE

#!/usr/local/bin/perl

# dir path
$sdir='.';
opendir(DIR,$sdir) || die "can't opendir $some_dir: $!";
@dots = grep {-d "$sdir/$_"} readdir(DIR);
rewinddir(DIR);
@fils = grep {-f "$sdir/$_"} readdir(DIR);
foreach (@dots){
print "$_\n";
}
foreach (@fils){
print "$_\n";
}
closedir DIR;

Reply