Hi Daniel.
I haven't looked at your code, but I don't think a rewrite is in the spirit of helping beginners at Perl. It may occasionally be the best answer, but I suspect you're simply enjoying yourself here ;)
I wonder what others think?
I have mixed feeling about it.
I think we generally teach them a little more by touching up what they have written, correcting their problems or providing simple insights. I think it sinks in a little better that way.
On the flip side, we can't teach them as much that way, because we can't show them the possibly better ways of doing things. I don't know about you, but I much prefer the structure of Daniel's version of the posted code (though hopefully without the duality bug :D ), to my own simple clean up. And as you have already pointed out, the problem is ripe for an OO solution as well, which I would like even better. While I would love to write that, I fear Joel isn't ready for that yet. (No offense Joel. You have a working program and that's all anyone can ask for early projects. Keep working at it and you'll get there.) Unfortunately, even Daniel's version is a bit too arcane, I think.
My original thought was to build a hash for each room (description, exits, etc.) and load them all into a master hash, by name. Then you could write a pretty simple loop to just walk the master hash. It would also be super simple to move that to disk based data files, which I think would be cool. That's probably closer to a design Joel might be able to put to good use, but I ruled even that out because I would have to use references.
Of course, if Joel keeps at this, eventually, he's going to try to go to one of these ideas and chances are we could maybe inspire him to that point with a teaser.
How's that for a circular answer? <laughs>
In the end, I think this is a perfect example of while Perl Beginners is a terrific resource. There's so many of us helping and we're all so different. Joel got some good answers from both sides of the fence and hopefully that will help him along. I don't know about you, but that's all I hope for in return for my time spent.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>