Blob


1 #!/usr/bin/perl
3 #Write a program that reads a list of strings (on separate lines) until end-of-input. Then it should print the strings in code point order. That is, if you enter the strings fred, barney, wilma, betty, the output should show barney betty fred wilma. Are all fo the strings on one line in the output or on separate lines? Could you make the output appear in either style?
4 #
5 use warnings;
6 use strict;
7 use utf8;
9 my @names = qw(fred betty barney dino wilma pebbles bamm-bamm);
10 print "Type numbers from 1-7, one on each line. Once finished, type ^d:\n";
11 chomp(my @numbers = <STDIN>);
12 foreach (@numbers) {
13 print "$names[$_-1]\n"
14 }