Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: How to access a hash from another file

by wfsp (Abbot)
on Oct 14, 2011 at 15:02 UTC ( #931539=note: print w/ replies, xml ) Need Help??


in reply to Re: How to access a hash from another file
in thread How to access a hash from another file

Yes and no. If the logic gets torturous I find it better just to create a table even if it is almost wholly repetitive. If it is large (or small), if most entries are the same or even empty. Perl doesnít mind tedious.

As soon as there are nots, ors and ands and they start nesting and cascading all over the place Iím certain, nay, guaranteed, to get it wrong. I find it hard to write, the bugs hard to find and they are most often the sort of bugs that appear six months down the line. Did I mention my boolean algebra is weak?

If it is appropriate and I can fit the logic into a table I get on much better, it is all reduced to a lookup. If it is not appropriate then yours is the way to go. What is appropriate, of course, is a matter of taste. :-)


Comment on Re^2: How to access a hash from another file
Re^3: How to access a hash from another file
by tospo (Hermit) on Oct 14, 2011 at 16:48 UTC
    well, Perl doesn't mind tedious but you might and you are likely to get nice little errors in the long table that will be difficult to find. Why risk it? It's like wanting to print out a multiplication table by hardcoding all the results instead of calculating them. Yes, you can do it and Perl doesn't mind but it would defeat the purpose, wouldn't it?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2014-09-30 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (378 votes), past polls