Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Hash ref and file extensions

by submersible_toaster (Chaplain)
on Aug 17, 2003 at 01:32 UTC ( #284382=note: print w/replies, xml ) Need Help??


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.

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.
Of course that is a regex being performed by File::Basename, YMMV.

Update: Totally untested , looks OK to me.


I can't believe it's not psellchecked

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://284382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2019-06-24 18:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (99 votes). Check out past polls.

    Notices?