|Perl: the Markov chain saw|
Re: Re: Re: Alpha base-26 to base-10... (golf)by bwana147 (Pilgrim)
|on Jul 01, 2003 at 10:46 UTC||Need Help??|
In Golf, there's no need for strict or quotes. A bareword is a string when Perl can't find an identifier with that name. So here, a is just "a", only two strokes shorter.
pop takes one argument off of @_, and since there's only one argument, it's just the same as shift. lc turns it to lower case.
.. is the range operator in list context, but the flip-flop operator in scalar context. The construct ()= forces list context. The value of a list assignment is the number of elements of the right member, even though the left value (()) is empty.
So this sub yields (in scalar context) the number of element between "a" and the string passed as argument. QED