<h2><a name="p-34924-perl-36-34-33-31-30-17-15-11-characters-1" class="anchor" href="#p-34924-perl-36-34-33-31-30-17-15-11-characters-1" aria-label="Heading link"></a>Perl, 36 34 33 31 30 17 15 11 characters</h2>
<pre><code class="lang-auto">$=()=A..$
</code></pre>
<p>Usage:</p>
<pre><code class="lang-auto">$ echo -n WTF | perl -ple '$=()=A..$'
16074
</code></pre>
<p>Reduced to 17 by using echo -n to avoid a <code>chop</code> call.</p>
<p>Reduced to 15 by using say instead of print.</p>
<p>Reduced to 11 by using -p instead of say.</p>
<p>Explanation:<br>
<code>A</code> is evaluated in string context and <code>A..$</code> builds a list starting at “A” and string-incrementing up to the input string. Perl interprets the <code>++</code> operator (and thus <code>..</code>) on strings in an alphabetic context, so for example <code>$="AZ";$_++;print</code> outputs <code>BA</code>.</p>
<p><code>=()=</code> (aka <a href="http://www.perlmonks.org/?node_id=527973">“goatse” operator</a>) forces an expression to be evaluated in list context, and returns the number of elements returned by that expression i.e., <code>$scalar = () = <expr></code> corresponds to <code>@list = <expr>; $scalar = @list</code>.</p>