Alphanumeric balance Write a program which gets a string as its input, and counts the number of alphanumeric and non-alphanumeric characters in it. It has to display its result like this:

input: http://stackexchange.com
output: 20 + 4 = 24

The catch is, your source code has to have the same number of alphanumeric characters as non-alphanumeric ones. Comments are not allowed, whitespace is ignored. (The language called Whitespace might compete for votes, but will not be selected as winner, obviously)

Characters in the code must have at least some minor justification, they should not be completely superfluous. For example, longer variable names are allowed, i = (j*3)+4; instead of i = j*3+4; is also allowed. However, i = i + 1;;;;;; is not.

Besides this, standard code-golf rules apply.
Perl, 32 + 32 = 64

The string is expected in STDIN. The output is written to STDOUT. White space is ignored. My interpretation of the task is that the program should be able to run on itself to get the score.

$/ = $,;
$_ = &lt;&gt;;
s x\sxxg;
$\ = length;
print s x[0-9a-z]xxgi,
      ' + ',
      s x.xxg,
      ' = '


Ungolfed with comments

$/ = $,; # The input separator becomes undefined, because the default for $, is "undef"
$_ = &lt;&gt;; # now $_ takes the whole file (STDIN) instead of the first line
s x\sxxg; # $_ =~ s/\s//g;
          # white space is removed from $_
$\ = length; # The number of the other characters are put into $\,
             # which is automatically printed the end of "print".
print s x[0-9a-z]xxgi, # s/[0-9a-z]//gi
                       # Remove alphanumeric characters and return their count
      ' + ',
      s x.xxg, # s/.//g
               # Remove the remaining special characters and return their count.
               # "." does not catch new lines, but we have already
               # removed white spaces including new lines.
      ' = '


I found several variations with the same byte counts, e.g.:

$/ = $x;
$_ = &lt;&gt;, s x\sxxg;
$\ = split $x;
print s x[\da-z]xxgi,
      " + ",
      s x.xxg,
      ' = '


Examples


Example from the question:

echo 'http://stackexchange.com' | perl a.pl
20 + 4 = 24

Running on itself (a.pl):

cat a.pl | perl a.pl
32 + 32 = 64


The file size is 104 bytes, thus 40 bytes are ignored as white space.


Perl, 29 + 29 = 58

$_=&lt;&gt;;s x\sxxg;$\=length;print s x[0-9a-z]xxgi,' + ',s/.//g,' = '


The string is expected at STDIN and it is limited to the first line. The result is printed to STDOUT.
White space is ignored.

Ungolfed

$_ = &lt;&gt;;
s x\sxxg; # same as s/\s//gx; removes white space;
$\ = length($_); # sum is automatically appended at the end of print
print sx[0-9a-z]xxgi, # same as s/[0-9a-z]//gi;
                      # the number of alphanumeric characters
      ' + ',
      s/.//g, # the number of the remaining special characters
      ' = '


Examples

File a.pl contains the Perl script.


Example from the question:

echo 'http://stackexchange.com' | perl a.pl
20 + 4 = 24

Running on itself:

cat a.pl | perl a.pl
29 + 29 = 58


The file size of a.pl is 65 bytes, thus 7 bytes are ignored as white space.