----- Original Message ----- 
From: "Jolok" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
Sent: Thursday, August 28, 2003 11:24 AM
Subject: printing elements of an array


> Hello
> 
> This should be very straightforward:
> 
> print "Enter 5 of your favorite foods: ";
> $favorites = ( <STDIN> );
> @foodlist=split(' ', $favorites);
> print "@foodlist\n";
> print "$foodlist[0]\n";
> print "$foodlist[1]\n";
>   ...
> 
> 
> But I am getting (as output):
> 
> food1 food2 food3 food4 food5
> 
> food1 food2 food3 food4 food5
> 
> 
> 
> 
> 
> end of output
> So, I'm guessing that the 'split' command is used incorrectly?
> 
> The desired output would be:
> 
> food1 food2 food3 food4 food5
> 
> food1
> food2
> food3
> food4
> food5
> 
> 
> Can someone steer me in the right direction?
> 
> --
> Best Regards,
> 
> Joshua Lokken
> OMIC Portland Branch
> [EMAIL PROTECTED]
> (503) 807-6538
> -------------------------------------------->
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to