You could probably do it with a global;
<%global_name($Contact_Email)%>
my $in = $_[0];
my $strings = q|
a~097
b~098
c~099
d~100
e~101
f~102
g~103
h~104
i~105
j~106
k~107
l~108
m~109
n~110
o~111
p~112
q~113
r~114
s~115
t~116
u~117
v~118
w~119
x~120
y~121
z~122
1~049
2~050
3~051
4~052
5~053
6~054
7~055
8~056
9~057
0~048
&~038
~032
_~095
-~045
@~064
.~046
|;
my $back;
my @address = split //, $in; # cut the email address up into each charachter...
my @strings = split /\n/, $strings;
foreach (@address) {
my $next;
foreach my $s (@strings) {
$s =~ s/\s$//g;
next if $next == 1;
my ($char,$equiv) = split /~/, $s; # get the charachter, and its numerical equiv
if ($char eq $_) {
$char =~ s/\Q$char/$equiv/i;
$char = '&#' . $char . ';';
$back .= $char; # add the new replacement to $back
$next = 1;
}
}
}
return $back;
}
I just gave it a quick test on my site, and it seems to work ok :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
<%global_name($Contact_Email)%>
Code:
sub { my $in = $_[0];
my $strings = q|
a~097
b~098
c~099
d~100
e~101
f~102
g~103
h~104
i~105
j~106
k~107
l~108
m~109
n~110
o~111
p~112
q~113
r~114
s~115
t~116
u~117
v~118
w~119
x~120
y~121
z~122
1~049
2~050
3~051
4~052
5~053
6~054
7~055
8~056
9~057
0~048
&~038
~032
_~095
-~045
@~064
.~046
|;
my $back;
my @address = split //, $in; # cut the email address up into each charachter...
my @strings = split /\n/, $strings;
foreach (@address) {
my $next;
foreach my $s (@strings) {
$s =~ s/\s$//g;
next if $next == 1;
my ($char,$equiv) = split /~/, $s; # get the charachter, and its numerical equiv
if ($char eq $_) {
$char =~ s/\Q$char/$equiv/i;
$char = '&#' . $char . ';';
$back .= $char; # add the new replacement to $back
$next = 1;
}
}
}
return $back;
}
I just gave it a quick test on my site, and it seems to work ok :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!