After reading this node, I dusted off one of my oldest perl scripts.
If you can't tell, I had just discovered regular expressions.
That last paragraph haxorfied:
4f73r r34d1n9 }{4c|<1n9, 1 du$73d 0ff 0n3 0f my 01d357 p3r1 5cr1p7z.
You can see, it goes really overboard, but I have actually seen people talk like this. Ahh, the joys of USENET.
#!/usr/bin/perl srand; sub ran { return $_[( rand (scalar @_ ))] } # Allow random choices while (<>) { $data = $_; # The conversion rules. # Watch the order if you decide to add your own. # Use the e regex switch and the "ran" function with a list of possibi +lities # to pick a random possibility. #Phrase conversions $data =~ s/(\btoo\b|\bto\b)\b/2/gi; $data =~ s/\belite\b/ran("eleet","leet")/gie; $data =~ s/\bdude/d00d/gi; $data =~ s/\bfile/phyle/gi; $data =~ s/\byou\b\b/ran("u","you","u","u")/gie; # Make "u" way more +probable $data =~ s/\bcool\b/ran("kool","kewl")/gie; $data =~ s/\bhacker/haxor/gi; #Single character conversions $data =~ s/ss^\b/ran("55","\$\$","\$\$")/gie; $data =~ s/s\b/ran("z","\$", "z")/gie; #s -word boundary to z $data =~ s/e/3/gi; $data =~ s/t/7/gi; $data =~ s/(l|i)/1/gi; $data =~ s/a/4/gi; $data =~ s/s/ran("5","\$","\$","\$")/gie; $data =~ s/b/8/gi; $data =~ s/g/9/gi; $data =~ s/o/0/gi; $data =~ s/n/ran("\/\\\/","n","n")/gie; #Huh? Convert n to /\/ $data =~ s/h/ran("h","\}\{")/gie; # h to }{ $data =~ s/k/ran("k","\|\<")/gie; $data =~ s/w/\\\/\\\//gi; # w to \/\/ print $data; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: 1 0\/\/Nz U DoodZ!
by japhy (Canon) on Feb 18, 2001 at 11:51 UTC | |
by howard40 (Beadle) on Feb 28, 2001 at 03:00 UTC | |
Re: 1 0\/\/Nz U DoodZ!
by davorg (Chancellor) on Feb 18, 2001 at 13:40 UTC |
Back to
Cool Uses for Perl