in reply to Getting Multiple inputs

Just have them enter the words all on one line using the delimiter of your choice - say a space - and then split the line into it's component words. Like so:
print "Enter some words (separated by spaces): >> "; chomp(my $line = <STDIN>); my @words = split /\s+/, $line;
Note that the "\s+" will split on one or more whitespace characters, so it will still work if they accidentally type two spaces between some words.

Cheers,
Darren :)

Replies are listed 'Best First'.
Re^2: Getting Multiple inputs
by ikegami (Patriarch) on Apr 05, 2006 at 18:52 UTC

    split /\s+/
    would probably be even better as
    split ' '

    >perl -e "@f = split(' ', ' a b c '); print scalar @f 3 >perl -e "@f = split(/\s+/, ' a b c '); print scalar @f 4

    ' ' does the same thing as /\s+/, but it ignores leading spaces.

    split's documentation

Re^2: Getting Multiple inputs
by sweetblood (Prior) on Apr 05, 2006 at 18:43 UTC
    And without the temp variable
    chomp(my @words = (split /\s+/,(<STDIN>)));

    Cheers

    Yeah, I know I'm paren happy

    Sweetblood

Re^2: Getting Multiple inputs
by gzayzay (Sexton) on Apr 05, 2006 at 17:21 UTC
    Thanks for the tip.