Good day, This would be quick and simple. I need to write a script that will prompt the user(using <STDIN>) to enter a series of numbers separated by white space and then push each of those numbers into an array and then do anything such as sorting it from highest to lowest.
I've tried doing it as: print "Enter your numbers separated by space: "; my @array = <STDIN>; print sort @array; ..nothing happened after pressing return. Then I've tried putting the <STDIN> to a scalar first before assigning it to an array. my $numbers = <STDIN>; my @array = $numbers; print $array[-1]; #(print the last element) Then it only printed exactly what I've entered as if it has treated the numbers as a single string. I'm thinking perhaps if only I could place the contents of <STDIN> inside a qw() and assign it to an array like this; @array = qw(23 43 2 5 1); then I would have no problem with spaces between them(and eventually I can do anything with each of its elements). Only that I don't know how to get it in place starting from user input <STDIN>. Any idea? Thanks. __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>