#!/usr/bin/perl -w # Expand RLE encoded string to text template. # # 2017-12-03 use strict; use constant NEWLINE => 33; use constant MIN_CHAR => 35; use constant MAX_CHAR => 91; use constant MIN_SPACE => 93; use constant MAX_SPACE => 126; while( my $line = <> ) { foreach my $c (unpack 'C*', $line) { if( $c == NEWLINE ) { print "\n"; } elsif( $c >= MIN_CHAR && $c <= MAX_CHAR ) { print "X" x ($c - MIN_CHAR + 1); } elsif( $c >= MIN_SPACE && $c <= MAX_SPACE ) { print " " x ($c - MIN_SPACE + 1); } } }