in reply to How to map a directory tree to a perl hash tree

This line:
eval join '', '$dirth->', ( map { '{\'' . $_ . '\'}' +} split '/', $File::Find::name ), '=""';
is dangerous for all the same reasons as it was the last two times this was brought up. See the thread containing my "Re: Re: stringification" for the most recent time, and follow the link contained within it to go to the older thread which looks a lot more like your code.

In short (as I'm also saying in two other threads right now as well),

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: How to map a directory tree to a perl hash tree
by Rudif (Hermit) on Mar 11, 2001 at 00:52 UTC
    AVOID STRING EVAL

    I will.
    I did have an inkling that a solution involving multiple references to the same data item (a nascent hash entry), perhaps combined with recursion, should be possible, but I could not see how it would fit together. But then as I wrote some test cases, initializing multilevel hashes, it dawned on me that I could construct similar Perl code on the fly and eval it - my first ever creative use for string eval. I must admit, I took the easy way out .-(
    I probably cost me a --, but I'm wiling to pay my way.

    Rudif