Another solution is to use a loop and push the words into an array as you get them. The user enters a blank line to stop entering words. This had the advantage that the user can input complete phrases.
use strict; use warnings; my @words; my $i = 1; while (1) { print "Enter word $i: >> "; $i++; chomp (my $word = <>); last unless length $word; push @words, $word; } print join(",", @words);
In reply to Re: Getting Multiple inputs
by eric256
in thread Getting Multiple inputs
by gzayzay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |