There are no stars in your input! And your script should work fine if there were.
With a little code cleanup it becomes:
my $output; while( my $line = <DATA> ) { # get rid of line terminator: chomp $line; next unless $line; # Get rid of line numbers: $line =~ s/^N[0-9]{2}\ //; # Replace * and the beginning of the line with !: $line =~ s/^\*/!/ and print $line and next; # Keep any numbers prefixed with X,Y or Z.: $line =~ s/(X|Y|Z)([0-9.-]+)/ $2/g; # Throw the rest away: $line =~ s/[A-Z][0-9.+-]+//g; print $line; } ...


T I M T O W T D I

In reply to Re: shouldn't this work? by Cine
in thread shouldn't this work? by airblaine

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.