Can you give us a reference (page, edition) for the code you showed (without using <c>...code here... </c> code tags; for shame. Read instructions at the SOPW text-entry box.) And check the O'Reilly site for reports of typos and corrections to whichever edition you're using.

I suspect there's either a typo or a prior discussion of capturing from STDIN, "Standard In," AKA "the console." If you follow your code at the command line with numbers, hoping that will feed them to split and @numbers the disappointment you specify will occur. But you'll get the expected results if you collect the user's numbers like this:

C:\>perl -E "print 'your input please: ' ; my $input = <>; say $input; +" your input please: 1 2 32 1 2 32

And, with the syntax you showed:

C:\>perl -E "print 'Enter nums: '; use Data::Dumper;@numbers; push @nu +mbers, split while <>; say Dumper @numbers;" Enter nums: 3 5 7 912 11 ^Z $VAR1 = '3'; $VAR2 = '5'; $VAR3 = '7'; $VAR4 = '912'; $VAR5 = '11';
If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.

In reply to Re: <> to read command line options? by ww
in thread <> to read command line options? by slackcub

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.