$_='gcc 92 !$* % "awk in I$: ar& $:a"';
foreach (/(\S)/g) {
$;.= substr(unpack("B*",pack(n,unpack("c",$_))),-4);
$;.= "\n" if !(++$i%5);
}
$_=$;;
y;0;\40;;
y;1;#;;
print;
Substituting $str for $; and making some other changes:
$_='gcc 92 !$* % "awk in I$: ar& $:a"';
foreach $char (/\S/g) { # Capturing parens not needed
$str.= substr(unpack("B*",pack(n,unpack("c",$char))),-4);
$str.= "\n" if !(++$i%5);
}
$_=$str;
tr/0/\40/;
tr/1/#/;
print $_;
Looking at the main substution in detail for the first character "g":
$str.= substr(unpack("B*",pack(n,unpack("c",$char))),-4);
unpack("c",$char) # is the same as
ord $char # 103
pack(n, ... # packs 103 as a little-endian int
unpack("B*", ... # Packs it as a binary string: 0000000001100111
substr(..., -4) # Get the last 4 chars: 0111
After these substitutions $str looks like this:
01110011001110010010
00010100101001010010
00010111101110011110
10010100101000010010
01100100101000010010
The transliteration could be done in one pass:
tr/01/ #/;
Applying the transliterations gives:
### ## ### # #
# # # # # # #
# #### ### ####
# # # # # # #
## # # # # #
I liked the joke about wcc and agk. :-) There is an example of a JAPH that does use an embedded awk (of sorts) here: JAAH
--
John.
|