i used to know this, but i don't remember anymore. Anyway, how would i count, lets say, the number of files in a folder that end with .id.
Aug 15, 2001, 11:42 AM
Veteran (19537 posts)
Aug 15, 2001, 11:42 AM
Post #2 of 4
Views: 2937
Hi,
Try...
my @count = ();
opendir(DIR, $dir) || die "Can't open $dir : $!";
@count = grep { /\.id$/i } readdir(DIR);
closedir(DIR);Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Try...
Code:
my $dir = "/path/to/dir"; my @count = ();
opendir(DIR, $dir) || die "Can't open $dir : $!";
@count = grep { /\.id$/i } readdir(DIR);
closedir(DIR);
Code:
my $total = scalar @count;Installations:http://wiredon.net/gt/
Aug 15, 2001, 11:59 AM
Veteran (19537 posts)
Aug 15, 2001, 11:59 AM
Post #4 of 4
Views: 2929
My pleasure - it saved me from a university assignment for a few minutes
Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/