print"Enter the number of Cricketers: ";
$list=<STDIN>;
chomp $list;
until($list<=0)
{
print"Enter Cricketer name: ";
$name=<STDIN>;
print"Enter a number: ";
$number=<STDIN>;
chomp $number;
$list--;
push(@names,$name);
push(@numbers,$number);
}
print"Cricketer's name and the corresponding number are\n";
format STDOUT=@<<<< @>>>>
"@numbers", "@names"
.
I have this code. The question is "Write a program that asks the user for a list of cricketer’s names and then a number. Print the cricketer’s name that is equivalent to the number as index."
I hope you can understand what I need. I need that code to print result in a formatted style like:
1 Sachin
2 Sehwag
3 Yuvraj
Answers to dhakshin@live.com are also welcome...
Thank you in advance........