Meriwether Lewis wrote:
>
> Hi Gurus!
Hello,
> I currently am displaying a list of choices for
> the user to select:
>
> 1. 1996 Corvette
> 2. 2001 Hummer
> 3. 1985 Blazer
> 4. 1987 Firebird
>
> I'm asking the user to enter a comma separated
> list of their choices.
>
> If the user enters:
>
> 1,3,4
>
> I need to store the year and make of their
> selections in different variables and process
> each one. I'm not sure how to coorelate the
> 1,2,3,4 with each year and make.
> Any help is appreciated.
Perhaps this will help get you started:
my @data = (
'1996 Corvette',
'2001 Hummer',
'1985 Blazer',
'1987 Firebird',
);
for ( 0 .. $#data ) {
print $_ + 1, ". $data[$_]\n";
}
my @sel;
do {
print 'Your selection(s) is/are: ';
@sel = map --$_, grep $_ > 0 && $_ <= @data, <STDIN> =~ /\d+/g;
} until @sel;
print "You selected: @[EMAIL PROTECTED]";
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]