Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: file tree to hash

by pg (Canon)
on Apr 06, 2003 at 00:09 UTC ( [id://248359]=note: print w/replies, xml ) Need Help??


in reply to file tree to hash

This is one way, less conventional:
use strict; use Data::Dumper; my %hash; while (<DATA>) { chomp; s/\//}{/g; eval "\$hash".substr($_,1,length)."} = undef"; } print Dumper(\%hash); __DATA__ /root/dir1/file1 /root/dir1/file2 /root/dir1/file3 /root/dir2/file1

Replies are listed 'Best First'.
•Re: Re: file tree to hash
by merlyn (Sage) on Apr 08, 2003 at 04:43 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-19 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found