$| = 1; # Don't buffer output print "\e[H\e[J\n"; # Clear the screen $S='|'; japh('82>2 ^7 22>5'); # 'J' japh('88^4 59>4 48/^2 812^6 29>2 />1'); # 'A' japh('815^4 515>4 415/^3 419^2 216>2 />1'); # 'P' japh('822^4 522>4 422/^3 825^7'); # 'H print "\e[24H"; # Jump to line 24 exit; # # This subroutine prints each letter of the word "JAPH" # It writes the words bottom-up, since going top-down # overwrites part of the letters that ultimately have to # be hidden by the sides. # sub japh { my $s = pop; $s =~ s/\s//g; while($s) { $s =~ s/^(\d)(\d+)// and ($y,$x) = ($1,$2); $s =~ s|^/|| and $S = $&; $s =~ s/^([>^])(\d)// and map { block($1) } (1..$2); } } # # This subroutine draws a single block, based on # the current values of the ($X, $Y) coordinates. # sub block { $s = "___ / /|/__/ || | $S|__|/"; $S = '|'; ($X, $Y, $Z) = (3*$x, 2*$y, 0); while ($b = substr($s,0,$Z+++4,"")) { print "\e[".$Y++.";$X"."H$b"; $Z>2? $Z=2: --$X; } select$d,$e,$f,.1; $_[0] eq '^'? $y--: $x++; } __END__ Commands: *YX go to coordinates (Y,X) / set symbol $S to '/' (normally '|') >N move/draw N pixels (right) ^N move/draw N pixels (up) 81>2^721>5 88^4811^75 '815^4515>4515/^3216>3'); # 'P' 822^4 522>4 422/^3 825^7