>>>>> "JL" == Jason Lewis <jasonlewi...@gmail.com> writes:
JL> Hey, this might be a stupid question... not a stupid question. but a dangerous one. JL> If I need to name a variable with the contents of another scalar, how do I JL> do that? reference? the answer is you don't do it (even though you can in perl). it is almost never needed for basic programs or data structures. the proper solution is always a hash. anytime you think of using a dynamic name, you think hash (which has dynamic names for the keys). learn this now and never forget it. in fact if you use strict (do you?) you can't use those nasty symbolic references which are so dangerous. and here is a better reason: using symrefs means you are just using the symbol table for a general data structure. but the symbol table is a special beast not meant to be use for general data structures. in fact it is slower than regular hashes (since it does special things), less safe (everything is always a global), harder to debug (action at a distance, etc.) and you can't pass around chunks of it in isolation like you can with a hash tree. ok, let's all repeat this one more time. don't use the symbol table for data structures. use a regular hash instead. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/