Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: All files in dir to Storable.pm data

by gbarr (Monk)
on Oct 03, 2001 at 01:56 UTC ( [id://116278]=note: print w/replies, xml ) Need Help??


in reply to All files in dir to Storable.pm data

You call readdir, but you do not check that the name you get back is indeed a file. More specifically you want to skip . and ..

read_dir from File::Slurp will do that for you. Also Storabe has a sub to write the data directly to a file

use strict; use Storable; use File::Slurp; my %html_files = map { ($_, scalar read_file($_)) } read_dir("."); store(\%html_files, "brick");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found