Although ikegami has provided a much shorter and better solution, I would like to come back to your very complicated syntax and suggest some possible improvements to the rest of your code. Using chomp, you could do this:
$ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\ +n",); chomp @words; print join";", @words;' one;two;three;four;five;six
Although I would not really recommend this, you could also use split if you really wanted to:
$ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\ +n",); @words = map {split /\n/, $_ } @words; print join";", @words;' one;two;three;four;five;six
Or perhaps a regex:
$ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\ +n",); @words = map {s/\n//; $_} @words; print join";", @words;' one;two;three;four;five;six
Or split again, but without a map this time:
$ perl -e '@words = ("one\n","two\n","three\n","four\n","five\n","six\ +n",); $_ = (split /\n/)[0] for @words; print join";", @words;' one;two;three;four;five;six
Or, if you don't want to use the join function:
$ perl -E '@words = ("one\n","two\n","three\n","four\n","five\n","six\ +n",); local $" = ";"; $_ = (split /\n/)[0] for @words; say "@words";' one;two;three;four;five;six
Well, I could probably offer at least a dozen other solutions mixing the various ideas above or introducing new ones, but I hope you get the idea of how to do the things in a much more concise way than what you had.

In reply to Re: split on newline by Laurent_R
in thread split on newline by tbone654

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.