Take a look at opendir and readdir, or File::Find if you want to get fancy. :-)
Update: A code example:
#! /usr/bin/perl use strict ; use warnings ; opendir MYDIR, '.' or die $! ; my @allfiles = grep { $_ ne '.' and $_ ne '..' } readdir MYDIR ; my @files = grep { !-d } @allfiles ; my @dirs = grep { -d } @allfiles ; print "Current directory contains " . @files . " files and " . @dirs . " directories.\n" ;
In reply to Re: A couple of ?'s
by DamnDirtyApe
in thread Finding files and subdirectories in a directory (was: A couple of ?'s)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |