pc88mxer has asked for the wisdom of the Perl Monks concerning the following question:
This yielded the output:sub v { ord($_[0]) - ord('A'); } print v('I')*26 + v('V'), "\n";
It then occurred to me that in the column name AB, the A has weight 1 (not weight 0), and so I was off by 26. I therefore modified the formula to:shell$ perl ./iv65536 229 shell$
and running it produced:print (v('I')+1)*26 + v('V'), "\n";
Why did it print 9, and where did the newline go?shell$ perl ./iv65536 9shell$
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Converting "IV" from base 26
by graff (Chancellor) on Jul 01, 2008 at 03:53 UTC | |
by Eimi Metamorphoumai (Deacon) on Jul 01, 2008 at 14:29 UTC | |
by ikegami (Patriarch) on Feb 09, 2009 at 19:27 UTC | |
|
Re: Converting "IV" from base 26
by BrowserUk (Patriarch) on Jul 01, 2008 at 03:51 UTC | |
|
Re: Converting "IV" from base 26
by poolpi (Hermit) on Jul 01, 2008 at 10:41 UTC | |
|
Re: Converting "IV" from base 26
by ambrus (Abbot) on Feb 09, 2009 at 18:23 UTC |