#!/usr/bin/perl -w # Expand run-length encoded text to template. # # A-Z = space. # a-z = char. # ! = newline. use strict; while( my $line = <> ) { foreach my $c (unpack "C*", $line) { if( $c == ord("!") ) { print "\n"; } elsif( $c >= ord("A") && $c <= ord("Z") ) { print " " x ($c - ord("A") + 1); } elsif( $c >= ord("a") && $c <= ord("z") ) { print "X" x ($c - ord("a") + 1); } } }