in reply to Hash ref and file extensions
Depending on how much of the work you really need to do yourself, File::Basename is a option.
Of course that is a regex being performed by File::Basename, YMMV.use File::Basename; use strict; my %exts; open FILE , '/some/big/file' or die "Screaming $!"; while ( <FILE> ) { chomp; my $file = $_; my ($name, $path, $suffix) = fileparse( $file , '\..*' ); $exts{$suffix}++; } # Dump your hash here.
Update: Totally untested , looks OK to me.
|
|---|