in reply to Re^2: property file parsing
in thread property file parsing

Yeah, _insert is even tail recursive, so making a loop from it is no big deal. But, believe it or not, those recursive solutions just come more easily to me.

BTW, your snippet fails to overwrite previously set to "True" scalar values. There is no case of this in the OP data sample. But this kind of anomaly is clobbered the same way by OP's script and mine.
So you can even argue, that your algorithm crashing on such data is a feature :)

Replies are listed 'Best First'.
Re^4: property file parsing
by rhesa (Vicar) on Feb 03, 2006 at 23:07 UTC
    Good point! I would also consider it a feature. I'd say it would be a syntax error in the config file, and I'd throw an exception for that if it happened.
      You might raise your own message, since Can't use string ("1") as a HASH ref while "strict refs" in use... isn't very descriptive to the end user for a data driven error ;-)