http://qs321.pair.com?node_id=485363
Category: HTML Utility
Author/Contact Info Ted Fiedler <fiedlert@gmail.com>
Description: a utility to translate an email or any text to HTML numeric entities. I generally use this to translate email addresses on web pages into numeric entities - the thought is that it may keep spiders from grabbing email addresses. Im not exactly sure if it does or not, but ignorance is bliss ;) It doesnt tolerate undefined characters.
#!/usr/bin/perl -w

use strict;

my $email    = $ARGV[0] or die "no email address given\n";

# setup our alphabet
my @alphabet = qw(a b c d e f g
                  h i j k l m n
                  o p q r s t u
                  v w x y z);

# Translate non alphanumerics first
my %translate=( "."  => "46",
                "-"  => "45",
                "\@" => "64",
                " "  => "32",
                "_"  => "95");

# translate our numbers
for ( 0 .. 9 )
{
    $translate{$_}                = $_ + 48;
}

# translate our alphabet
for ( 0 .. 25 )
{
    $translate{$alphabet[$_]}     =  $_ + 97;
    $translate{ uc $alphabet[$_]} =  $_ + 65;
}

print "&#" . sprintf("%03d", $translate{$_}) for (split //, $email);

print "\n";