”I am new to perl and somehow I wrote the code in perl."

I think it's disingenuous to claim you wrote this code. The idea behind such challenges which you've copied/paste here is that the participant exercise their skills.and try out new tricks. Since you claim to be new to perl I suggest your time would be better spent learning the basics, rather than keep asking people to improve someone else's answer (inbox spam isn't a wise course of action by the way), http://learn.perl.org, learn perl in 2 hours 30 minutes. Work through the tutorials section of this site. Ask specific questions (How do I post a question effectively?), rather than repeat "do it for me" type requests.


In reply to Re:reduce code by marto
in thread Golf code in perl by tt08

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.