in reply to %hash (@array && use constant) in Modules

except for the non-automagic exportation of the use constant subs

Why would you want them exported? It's easier to write accessors, or use hash keys. To export all constants (well, to export all all-uppercase-subs), you could use:

use Devel::GetSymbols; @EXPORT = grep /^[A-Z0-9_]+$/, Devel::GetSymbols::Subs;

Part of it is laziness: typing " " as opposed to "{ }", which requires a shift key.

I still find $foo{bar} easier to type than $foo[BAR]. Hashes are better for lazy people: you don't have to define a new constant every time you want to store more, and if you don't care much about style, you can skip some accessor methods too. Hashes dump better too, in case you need to debug.

Also, I was taught early in my career that array lookups are faster than perl's hashing and table-lookups.

It is true, but I still like saving minutes on coding better than saving a few nanoseconds on execution.

And I don't need to get into the autoviv. of hashes.

Exactly the same, but less inefficient if you have a lot of keys. If you set $foo[100], you'll have 100 undef values and the one you assigned to.

What are you're preferences?

Hashes, unless I need to save only one, two or three things, in which cases I use scalar or array references.

Is the speed issue that much of an issue?

Not to me. If speed were the issue, I wouldn't be coding OO anyway.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.