Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: hash name as a variable?

by DrHyde (Prior)
on Sep 16, 2004 at 08:44 UTC ( #391388=note: print w/replies, xml ) Need Help??


in reply to hash name as a variable?

Don't EVER put a variable name in a variable.

I created hash tables for each of these instances and then hit a snag. Instead of duplicating the code for each hash table I thought I would just have the one piece of code with the relevant hash table name as a variable.

Have a single subroutine which takes a reference to the appropriate hash as one of its parameters.

Incidentally, you really should reduce the code needed to demonstrate your problem to the bare minimum. You posted too much code, and I don't have the patience to read it.

Replies are listed 'Best First'.
Constructive Criticism (was: hash name as a variable)
by Rhys (Pilgrim) on Sep 16, 2004 at 14:05 UTC
    Incidentally, you really should reduce the code needed to demonstrate your problem to the bare minimum. You posted too much code, and I don't have the patience to read it.

    In that case, rather than complaining, we could teach the OP about <readmore> tags.

    When posting long messages - particularly those containing large chunks of code - it's often wise to enclose the 'long part' like this:

    <readmore> # long part </readmore>

    That way, a link is automatically created so we only have to see the enclosed text if we need to. This keeps the visible post much shorter and easier to digest. This and other useful info is available at Writeup Formatting Tips.

    Hope that helps!

    --J

    Update: Changed node title to better reflect content.

    Update 2: Changed node title again to 'link' to original thread.

      All "read more" would have done is hide some of the code. It wouldn't have cut the code down to the bare essentials which would have illustrated the OP's problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-12-04 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?