I've got the following script:
#!/usr/bin/perl
my @a = ();
while ($line = <>) {
while (@a) {
pop @a;
}
chomp $line;
while ($line =~ m/^([\d]+)[\D]/) {
push @a, $1;
$line =~ s/($1).//;
}
push @a, $line;
for ($x = 0; $x < $#a; $x++) { print chr($a[$x]); }
print chr($a[$x]), "\n";
}
Which converts dot seperated ascii values like the following to plain-text
7.101.120.97.109.112.108.1
01 = example (there are 7 chars in the word example)
and 7.101.120.97.109.112.108.1
01.10.115.
101.114.11
8.105.99.1
01.49.48.4
9 equates to example service101 (as example is 7 chars long, and service101 is 10 chars)
The problem is that when the char_count is a "9" or a "10", in ascii those are Horizontal Tab and Line feed respectively. I'm actually very positive I won't need any ascii code below 32 (if there are any, aside from 9&10)
Actually we can eliminate the "char_count" seperator and replace it with a space in the output or as ascii before the conversion I guess.
So the output of 9.116.101.115.116.105.110.
103.49.50.
9.116.101.
115.116.10
5.110.103.
49.50 would convert to "testing12 testing12" rather than "testing12testing12" note the space placement.
Again I don't need any ascii value 0-31 to be translated via "chr" anything below 31 can simply be converted to a space.
9.116.101.115.116.105.110.
103.49.50.
9.116.101.
115.116.10
5.110.103.
49.50 (testing12 testing12)
10.116.101.115.116.105.110
.103.49.50
.51 (testing123)
11.100.105.100.45.105.116.
45.119.111
.114.10710
.116.101.1
15.116.105
.110.103.4
9.50.51
10.116.101.115.116.105.110
.103.49.50
.50.9.116.
101.115.11
6.105.110.
103.49.50
reference
http://xinn.org/Css-Rosetta-Stone.htmlthanks!
-rich