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

Everyone's comments are right. If you want to eek out every possible ounce of performance, arrays are faster, but for 99.99% of the jobs, hashes will do more than what you need, and they have other benefits in terms of object inheritance.

What I'm surprised no one has touched upon is:
Part of it is laziness: typing "[ ]" as opposed to "{ }", which requires a shift key.

Can you explain to me exactly how you're typing '[BAR]' without using the shift key? I suppose you could hit the caps lock key, but again, no decrease in the amount of work done.

As an aside, I did implement a class using pseudo-hashes (still use it in fact, very robust). While the whole idea may be very bad, it's worked out well for us. Our performance bottlenecks were elsewhere, though.

  • Comment on Re: %hash (@array && use constant) in Modules

Replies are listed 'Best First'.
Re: Re: %hash (@array && use constant) in Modules
by abaxaba (Hermit) on Apr 25, 2002 at 02:38 UTC
    I suppose, Hunter, that you are correct, regarding the shift keys. Typing BAR does require using shift. I was thinking more in terms of {bar} as opposed to [bar], I guess.

    Maybe I just hate typing curly brackets! :)