in reply to Creating on-the-fly hashes?

First of all what you are heading for looks like it is exactly what Dominus warned against here. (I suggest reading parts 2 and 3.)

Your actual question is answered by just using a hash:

$stuff{$1} = $2;

A deeper point though. If your code has (by your own admission) complex logic and complex conditions then there are good odds that if you step back and rethink it you can find ways to simplify. Try to do that.

Clean code isn't just aesthetic. Most of the money that will be spent on your code is spent in maintainance. Is the logic so messy that it would be hard for someone who did not know the code to figure it out and fix a bug or add a new feature? If so then how hard will it be for you in a month to fix bugs people find or deal with a changing spec?

Replies are listed 'Best First'.
Re: Creating on-the-fly hashes?
by Dominus (Parson) on Jan 08, 2001 at 23:50 UTC
    Says tilly:
    First of all what you are heading for looks like it is exactly what Dominus warned against here.

    What he's doing is even worse than the stuff I was warning against. I've been meaning to write a Part 4 in that series that discusses eval. Someone showed up in clpm once and said that his original try (with symbolic references) hadn't worked because strict was on, but he'd goitten around it by using eval, completely missing that this made the problem worse, not better.