Comment Encode your email addresses (Score 1) 310
I'm certain most slashdot readers can wipped up there own (and there is probably a better way), but here is a quick script which will HTML encode all the email addresses in a file.
#!/usr/local/bin/perl -pi.bak
while( m/(\@|\&\#0?64;)([\w-\.]+)(\.|\&\#0?46;)(com|org|n et|gov)/ ){
my $x = encode($2);
my $y = encode($4);
s/(\@|\&\#0?64;)([\w-\.]+)(\.|\&\#0?46;)(com|org|n et|gov)/\&\#064;$x\&\#046;$y /;
}
sub encode {
my $str = shift;
my @str = split( //, $str );
foreach my $c (@str){
$c = sprintf( "\&\#%03d\;", ord($c));
}
return join('', @str);
}
#!/usr/local/bin/perl -pi.bak
while( m/(\@|\&\#0?64;)([\w-\.]+)(\.|\&\#0?46;)(com|org|
my $x = encode($2);
my $y = encode($4);
s/(\@|\&\#0?64;)([\w-\.]+)(\.|\&\#0?46;)(com|org|
}
sub encode {
my $str = shift;
my @str = split(
foreach my $c (@str){
$c = sprintf( "\&\#%03d\;", ord($c));
}
return join('', @str);
}