#!/usr/bin/perl -w
use strict;    # follow the rules
$| = 1;        # unbuffer STDOUT

my $i = 1;
my $t = 1;
my $chars;
my $line_divider = qq{     |
     |_______________________|_______________________|_______________________|_______________________|
     |                       |                       |                       |                       |
};

while ($i < 257) {
   $t = 1 if $t == 5;
   my $ascii = chr($i);
      $ascii = '\b' if $ascii eq "\b";
      $ascii = '\n' if $ascii eq "\n";
      $ascii = '\r' if $ascii eq "\r";
      $ascii = '\t' if $ascii eq "\t";
      $ascii = '\f' if $ascii eq "\f";
      $ascii = '\v' if $ascii eq "\v";
      $ascii = '\a' if $ascii eq "\a";
      $ascii = '\e' if $ascii eq "\e";
      $ascii = '\s' if $ascii eq "\s";
      $ascii = '\?' if ($i == 32 or $i == 173 or $i == 256);

   my $count_padding = ' ' x abs(length($i) - 3);
   my $count_disp = $count_padding.$i;
   my $ascii_padding = ' ' x abs(length($ascii) - 2);
   my $ascii_disp = $ascii_padding.$ascii;
   
   $chars .= "     \|     ASCII $count_disp: ".$ascii_disp;
   $chars .= $line_divider if $t == 4;
   $i++;
   $t++;
}

print "Content-type:text/plain\n\n" and print <<ENDOUT and exit;
=======================
ASCII CHARACTER CHART
=======================

      _______________________________________________________________________________________________
     |                       |                       |                       |                       |
$chars

ENDOUT