Wiggins d Anconia writes:
 > While attempting to figure out a way to do conversion of large (overly)
 > integers from base 10 to base 36, and back again I naturally went to
 > CPAN and looked at Math::Base36, which appears to have a bug in its use
 > of 'index' to determine if a character is not a valid base36 character,
 > at least by the versions of the docs for index that I have access to. 
 > 'index' returns 0 or greater for the position, with -1 being a not
 > found.  Has this changed? Did 'index' start at 1 in the past?

When "number = index(string, pattern);" was first introduced in the
late 1960's in PL/1, all arrays were 1-origin indexing by default, and 
so were strings.  intex() returned zero to indicate "not found".  I
myself, and probably many other "old timers" still make the mistake of 
reverting back to he way we originaly learned it, probably because it
was so handy to just check for zero to see if it found anything.

Admittedly, 0-origin indexing for arrays and strings makes more
methematical sense, as remaindering can then be used to calculate
subscripts, but old habits die hard.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to