Category: | Miscellaneous |
Author/Contact Info | Marco Lima <mago at rio.pm.org> |
Description: | Counting the Extensions of the Archives in Current Directory. |
#!/usr/bin/perl -w
use strict;
my %extensions;
while (<*>) {
if (-f && /\.(\W+)$/) {
$extensions{$1}++;
}
}
foreach $key (keys %extensions) {
print "$key -> $extensions{$key}";
}
__END__
LINE:
perl -e 'while(<*>){if(-f && /\.(\W+)$/){$e{$1}++}}print "$_ -> $e{$_}
+\n" for keys %e'
|
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Counting the Extensions of the Directory
by merlyn (Sage) on Dec 13, 2005 at 21:39 UTC | |
by Mago (Parson) on Dec 14, 2005 at 12:54 UTC | |
Re: Counting the Extensions of the Directory
by EdwardG (Vicar) on Dec 14, 2005 at 10:39 UTC | |
by Mago (Parson) on Dec 14, 2005 at 12:48 UTC | |
by EdwardG (Vicar) on Dec 14, 2005 at 12:59 UTC | |
by Mago (Parson) on Dec 14, 2005 at 13:08 UTC |
Back to
Code Catacombs