In addition to the good answers you already got, which I recommend you to read carefully to understand what's going on, you can get what you want with a syntax similar to yours with a slight abuse of map:

my @Parts = map split, $Phrase;

I recommend that you do not cargo-cult this usage though, and postpone adopting it to when you will understand exactly what's going on in it too. Also because this doesn't really buy you anything that split basic usage as in rhesa's example won't.

While we're there, one more warning: you must have noticed that people here suggested using a string contining a single space as a first argument. Notice that this is a special case, which is supposed to what you want - because it's in fact what often people want, which in turn is the reason why it's the default. But in general split expects a proper pattern as a first argument. If you give it a string, then it will be automatically converted. It is generally recommended that you use a real pattern instead.


In reply to Re: Split ( ) is Giving Me a Splitting Headache by blazar
in thread Split ( ) is Giving Me a Splitting Headache by HughBris

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.