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
In reply to Re: file tree to hash
by pg
in thread file tree to hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |