Stephen Turner wrote:
> Can someone explain to me why
>
> -l use POSIX;print strtol pop,36
>
> doesn't work? Where does the extra 0 come from?

To quote myself to Dave and Jerome:

BTW, because I felt you were already inundated with queries about
it, I did not bother you with what seems to be a Perl bug that
prevents a 32-stroke solution from working. I was too lazy to
analyse it (instead, I trusted that Ton would, but since he has
not posted 32, I guess it cannot be worked around).

#!/usr/bin/perl -l
use POSIX;print strtol pop,36

I think this should work, but it prints a spurious trailing zero.

These two programs perhaps make it a little clearer:
  c4.pl:
  use POSIX;print strtol(pop,36)
  c5.pl:
  use POSIX;print 0+strtol(pop,36)
When you run:
  perl c4.pl 9
it prints 90, while:
  perl c5.pl 9
prints 9. Go figure!

Maybe Perl golf is useful, after all -- as a QA tool to find
Perl bugs. :)

/-\ndrew

Reply via email to