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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.