in reply to <> to read command line options?

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.

Replies are listed 'Best First'.
Re^2: <> to read command line options?
by slackcub (Novice) on Aug 16, 2013 at 02:57 UTC

    6th edition (epub from O'Reilly), page 390, chapter 14 example answers. I looked at the errata on O'Reilly's website and didn't see any mention of it. I'll have to do some looking around.

    And I apologize for my misuse of <c>. I guess I'm used to using it when quoting anything on other forums.

      And in the print version on my desk, question on page 246, answer on page 320.