That's like saying I like Carpentry but I don't like drills. Then you spend your time trying to bore a hole with your screwdriver, the cabinet takes for ever to build and it's not all that sturdy.
Or, I'm going to write a novel, but I'm not going to use adjectives.
Hashes are one of the basic tools of the language. You wouldn't code a large C project without pointers, would you?
Problems that would be innefficient using arrays like existance checks and counting occurances are quick and painless with hashes. And order is as simple as:
foreach (sort keys %hash) {
my $item = $hash{$_};
...
}
Not much worse than:
foreach my $item (@array) {
...
}
Plus there is no effort involved in inserting and delete and maintaining order.
I usually judge the progress of junior perl programmers by their use of hashes. When they stop trying to use arrays to do the job of a hash, they've leveled up in perl. (BTW, regexp are the second tier, then map/grep)
Of course this is all just my opinion,
-pete
Entropy is not what is used to be.
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.