title: Formatting parsed output perl
body: <p>I have this file - all I need is the last five lines from the file.
  I know that I am not supposed to parse html without a html module. but this is not really like
  a program strict - I mean all I really need is the last five lines or so. Besides I cannot download
  any modules. I do have access to the proxy server which allows me to curl files from the command line
  so maybe there is a way to use cpan fromteh or through the proxy - but that is a nother matter.
  the matter at hand is that when I parse out thelast file lines or so, I don't get the
  "Names IN MY-DEPT that are restricted"
   and I want it. it gets skipped.</p>
  
  <pre><code>new_guy@casper0170foo:~/hey/hit_BANK_restricted.$ cat restricted.html.bak
  To:DL-BANK@big_business.com
  From:dl-dept?g-gsd-stm@big_business.com
  Subject: Restricted List for 25-Nov-2014
  Content-Type: text/html;
  Content-Transfer-Encoding: quoted-print HTMLFILEable&gt;
  &lt;HTML&gt;
    &lt;HEAD&gt;
       &lt;STYLE type="text/css"&gt;
       body    { font-family: verdana; font-size: 10pt }
       td      { font-size: 8pt; vertical-align: top }
       td.cat  { color: 6699FF ; background: 666699; text-align: right; vertical-align: bottom; height: 30 }
       td.ind  { width: 20pt }
       td.link { }
       td.desc { color: a0a0a0 }
       a:visited { color: 800080; text-decoration: none }
      &lt;/STYLE&gt;
   &lt;TITLE&gt;TRADES&lt;/TITLE&gt;
   &lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE width="80%" border="0" cellpadding="0" cellspacing="0"&gt;
        &lt;tr&gt;
           &lt;td colspan="3" align="center"&gt;Names IN MY-DEPT that are restricted&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;b&gt;Restriction Code&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;b&gt;Company&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;b&gt;Ticker&lt;/b&gt;&lt;/td&gt;
       &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;RL5&lt;/td&gt;&lt;td&gt;First Trust Global Risk Managed Inc&lt;/td&gt;&lt;td&gt;ETP&lt;/td&gt;&lt;/tr&gt;&lt;font color="red"&gt;&lt;tr&gt;&lt;td&gt;RLMT&lt;/td&gt;&lt;td&gt;GT Advanced Technologies Inc&lt;/td&gt;&lt;td nowrap&gt;GTATQ (position only, not in MY-DEPT)&lt;/td&gt;&lt;/tr&gt;&lt;/font&gt;&lt;/TABLE&gt;&lt;/BODY&lt;/HTML&gt;new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$ cat parse_restrict2
  #!/usr/bin/perl
  use strict;
  use warnings ;
  my @restrict_codes = qw(RL3 RL5 RL5H RL6 REGM RAF RLMT RTCA RTCAH RTCB RTCBH RTCI RTCIH RLSI RLHK RLJP RPROP RLCB RLCS RLBZ RLBZH RLSUS);
  my $rest_dir = "/home/new_guy/hey/hit_BANK_restricted./";
  my $restrict_file = "restricted.html.bak" ;
  open my $fh_rest_codes, '&lt;', "$rest_dir$restrict_file" or die "cannot load $! " ;
  while (&lt;$fh_rest_codes&gt;) {
      next unless $_ =~ m/Names/;
      my @lines = &lt;$fh_rest_codes&gt; ;
      }
  foreach(@lines) {
      s/td/ /g ;
      s/&lt;[^&gt;]*&gt;/ /g ;
      foreach $restrict(@restrict_codes) {
          s/$restrict/\n$restrict/g;
          }
      print $_ ;
      sleep 1  ;
      }
  
  print "\n" ;
  </code></pre>
  
  <p>These are the results that I get:
  They are Ok but I would like to format them and I do not know how.</p>
  
  <pre><code>new_gue@casper0170foo:~/hey/hit_BANK_restricted.$ cat parse_restrict^C
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$ ./parse_restrict2
  
  
            Restriction Code
            Company
            Ticker
  
  RL5  First Trust Global Risk Managed Inc  ETP
  RLMT  GT Advanced Technologies Inc  GTATQ (position only, not in MY-DEPT)
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  new_guy@casper0170foo:~/hey/hit_BANK_restricted.$
  </code></pre>
  
  <p>Would there be any way possible to get the lines in this kind of format.</p>
  
  <pre><code>Names IN MY-DEPT that are restricted
  
  Restriction Code Company                              Ticker
  RL5              First Trust Global Risk Managed Inc  ETP
  RLMT             GT Advanced Technologies Inc         GTATQ (position only, not in MY-DEPT)
  </code></pre>