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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://284382]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-18 02:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found