Permalink
Newer
Older
100644 44 lines (42 sloc) 609 Bytes
Jun 9, 2008
1
package main;
2
3
sub mangle {
4
my @list = @_;
5
for (@list) {
6
s/\`/Grave/g;
7
s/\~/Tilde/g;
8
s/\!/Bang/g;
9
s/\@/At/g;
10
s/\#/Sharp/g;
11
s/\$/Dollar/g;
12
s/\%/Percent/g;
13
s/\^/Caret/g;
14
s/\&/Amp/g;
15
s/\*/Star/g;
16
s/\(/Paren/g;
17
s/\)/Thesis/g;
Jun 9, 2008
18
s/\-/Minus/g;
19
s/\+/Plus/g;
20
s/\=/Equal/g;
21
s/\{/Cur/g;
22
s/\}/Ly/g;
23
s/\[/Bra/g;
24
s/\]/Ket/g;
25
s/\|/Vert/g;
26
s/\\/Back/g;
27
s/\:/Colon/g;
28
s/\;/Semi/g;
29
s/\'/Single/g;
30
s/\"/Double/g;
31
s/\</Lt/g;
32
s/\>/Gt/g;
33
s//Fre/g;
34
s//Nch/g;
35
s/\,/Comma/g;
36
s/\./Dot/g;
37
s/\?/Question/g;
38
s/\//Slash/g;
39
s/(\W)/sprintf("_%02x_",ord($1))/eg;
40
}
41
join '_', @list;
42
}
43
1;