<p>I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file with no file extention. </p>

<p>How can I tell the difference? </p>

```
```
print "$file is a directory\n" if ( -d $file );
```
```