in reply to Not so cryptic

Deconstruction a speciality. Rather than explain extensively I have gone for the plain perl recoding approach to make it blindingly obvious how this works. I like this JAPH. cheers tachyon #!/usr/bin/perl -w use strict; # this string identifies the key encoding features basically the # length, but also the . and , The ) is meaningless other than # not meaning something! The final full stop does nix. $_="xxxx xxxxxxxxxx xxxxxxx xxxxx xxxxxxx xxx xxxxxxx xxxx xx, xxxxxx x xxxxxx xxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxx xxxx xxxxxx xxxxxxxx xxxxxx xxxxx xxxxxxx xx xx. xxxxx, xxxxxx xxxxx xxxxxxx xx xxxxxx xxxxxxxxxxxx xx. xxxxxx xxxxxxxx xxxxxx x) xxxxxx xxx xxxxxx xxxxxxxxxxx xxxxxx xxxxx xxxxxxx xx."; # this loop replaces the map for (m/x+|[\.,]/g) { push @a, eval'(/[\.,]/) ? 0 : length $_'; } # net result of map step is: # @a = qw(4 10 7 5 7 3 7 4 2 0 6 1 6 14 6 15 7 4 6 8 6 5 7 2 2 0 5 0 6 + 5 7 2 6 12 2 0 6 8 6 1 6 3 6 11 6 5 7 2 0); # this breaks down the second line into self evident steps while ($foo = shift @a) { $hex_code1 = sprintf "%x", $foo; $hex_code2 = sprintf "%x", shift @a; $hex = $hex_code1.$hex_code2; $dec = hex $hex; $ascii = chr $dec; print $ascii; } # Notes $$ is the $PID, I substitute $foo just because # %x is unsigned integer in hex so sprintf %x, $foo converts $foo # to hex. # The '%x'x2 is the same as "%x%x" # sprint "%x%x", $a ,$b; shoves both $a and $b into hex format

Replies are listed 'Best First'.
Re: Re: Not so cryptic
by iamcal (Friar) on May 23, 2001 at 11:31 UTC
    exellent breakdown - completely correct.