Joshua Lokken wrote: [ . . ]
While your way is much easier and works well, I wonder why my original syntax did not produce the desired result?
Your (next, below) original syntax does produce the desired result here (tested). Win32 Activestate Perl 5.61 build 633
#!perl print "Enter 5 of your favorite foods: "; $favorites = ( <STDIN> ); # @foodlist=split(' ', $favorites); @foodlist=split / /, $favorites; print "@foodlist\n"; print "$foodlist[0]\n"; print "$foodlist[1]\n";
Tested, Either of those two split lines produces the same result for me. I don't know reason(s) to prefer one over the other.
(in addition to warn and strict), default behavior(s) utilized next (tested, works)
#!perl use warnings; use strict; print "Enter 5 of your favorite foods: "; $_ = ( <STDIN> ); my @foodlist = split; print @foodlist, "\n\n"; print "$foodlist[0]\n"; print "$foodlist[1]\n";
# hmm, @foodlist prints without space between each word; I not sure how to get a space put back in between each word there.
-- Alan. Editor says: "remove dot twice if reply"
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]