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!"
in reply to Re: Apparent Inconsistencies in Perl Function Naming
in thread Apparent Inconsistencies in Perl Function Naming
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
@a=qw(joe bob dude cool);
print length @a;
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.