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';
In reply to Re: <> to read command line options?
by ww
in thread <> to read command line options?
by slackcub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |