There's more than one way to do things | |
PerlMonks |
Re: Re: Apparent Inconsistencies in Perl Function Namingby kael (Monk) |
on Nov 26, 2000 at 02:11 UTC ( [id://43327]=note: print w/replies, xml ) | Need Help?? |
ok, I was confused about length too but I did a test program up, once I realized what it's doing i said "DUH!!! Of course!" Here's the deal this returns 1. Why? length returns the length of a string in characters. the string you gave it was @a which is the # of elements in the array @a. in this case 4 since 4 has a length of 1 character it returns 1. if you push the array so it's 10 elements it'll return 2. But I am forced to wonder, if you were asked to count all the letters on a page, this is simple. But what if you were told to count all the letters on this page and handed a book. what would you do? count the letters on the cover, on all the pages within the book, or count the number of pages. which of these is most logical? My mind thinks in perl all the time, and to me this is all perfectly logical and exactly how I'd expect it to be. course everyone thinks diffrently.
In Section
Seekers of Perl Wisdom
|
|