1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
3 ffd9a51f 2023-08-04 jrmu #Write a program that reads a list of numbers (on separate lines)
4 ffd9a51f 2023-08-04 jrmu #until end-of-input and then prints for each number the
5 ffd9a51f 2023-08-04 jrmu #corresponding person's name from the list shown below. (Hardcode
6 ffd9a51f 2023-08-04 jrmu #this list of names into your program. That is, it should appear in
7 ffd9a51f 2023-08-04 jrmu #your program's source code.) For example, if the input numbers
8 ffd9a51f 2023-08-04 jrmu #were 1, 2, 4, and 2, the output names would be fred, betty, dino,
11 ffd9a51f 2023-08-04 jrmu #fred betty barney dino wilma pebbles bamm-bamm
13 ffd9a51f 2023-08-04 jrmu use warnings;
17 ffd9a51f 2023-08-04 jrmu my @names = qw(fred betty barney dino wilma pebbles bamm-bamm);
18 ffd9a51f 2023-08-04 jrmu print "Type numbers from 1-7, one on each line. Once finished, type ^d:\n";
19 ffd9a51f 2023-08-04 jrmu chomp(my @numbers = <STDIN>);
20 ffd9a51f 2023-08-04 jrmu foreach (@numbers) {
21 ffd9a51f 2023-08-04 jrmu print "$names[$_-1]\n"