Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

by spiritway (Vicar)
on Sep 03, 2005 at 02:35 UTC ( [id://488835]=note: print w/replies, xml ) Need Help??


in reply to “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

Old Russian saying: "This work is not easy, to drag a hippo from a swamp" (admittedly it loses something in translation). Your frustration is understandable. However, I think you overlook one of the important points about Perlmonks, why it is so useful.

Perlmonks is so useful because you often get so many different answers to your question. Everyone has a slightly (or hugely) different take on your question, comes up with something a bit different. Yes, there are wrong answers. People often misread the question, misunderstand the subtleties of Perl, or otherwise err. That's part of the price we all pay for having a "free" source of information - it's not 100% tested and accurate. Still, neither is Windows, and you pay for that...

Your question about the number of elements in an array *has* been answered, and abundantly so. There is a Perl idiom that returns the number of elements in an array.

Your question about the index of an element of an array is not specifically a Perl question to begin with. It arises in every language that has arrays, and it is not a trivial question. You can sort your array and speed up the searching, but in general you'll have to go look for it, no matter what language you use. Hashes are quicker but come with a price, and you might not care to pay that price.

The point is, there's no one "right" way to do most things in Perl, which is what makes it such a versatile and dynamic language. What you're complaining about - and I agree, it's very frustrating at times - is also one of the major strengths of Perl. There really is more than one way to do it, and you're likely to hear several of them each time you ask a question. In the final analysis, it's up to you to decide which answer is appropriate, if any - or to develop yet another way to do it, and maybe share that with us.

  • Comment on Re: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-24 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found