# script to obfuscate email addresses for web pages.
# just copy-n-paste the output into your web page
use strict;
my $email = 'first.last@mycompany.com'; # edit this line - your email goes here
print obfuscate_email($email), "\n";
sub obfuscate_email {
my $email = shift;
my $string = "" . $email . "";
return obfuscate_text($string);
}
sub obfuscate_text {
my $string = shift;
$string =~ tr/[a-mn-zA-MN-Z]/[n-za-mN-ZA-M]/; # rot13
$string =~ s/@/@/g; # swap @ for the html character code
$string =~ s/"/\\"/g; # escape doublequotes
$string =~ s/\./\056/g; # swap the dots with javascript . characters
my @charset = ('a'..'z','A'..'Z');
# randomize variable name - (3 char)
my $c = join '', @charset[rand @charset, rand @charset, rand @charset];
my $result = "";
return $result;
}