Blame


1 ffd9a51f 2023-08-04 jrmu #!/usr/bin/perl
2 ffd9a51f 2023-08-04 jrmu
3 ffd9a51f 2023-08-04 jrmu # Write a program that reads a list of strings on separate lines
4 ffd9a51f 2023-08-04 jrmu # until end-of-input and prints out the list in reverse order. if
5 ffd9a51f 2023-08-04 jrmu # the input comes from the keyboard, you'll probably need to signal
6 ffd9a51f 2023-08-04 jrmu # the end of the input by pressing Control-D on Unix, or Control-Z
7 ffd9a51f 2023-08-04 jrmu # on Windows.
8 ffd9a51f 2023-08-04 jrmu
9 ffd9a51f 2023-08-04 jrmu use warnings;
10 ffd9a51f 2023-08-04 jrmu use strict;
11 ffd9a51f 2023-08-04 jrmu use utf8;
12 ffd9a51f 2023-08-04 jrmu
13 ffd9a51f 2023-08-04 jrmu print "Type your input. Once finished, type ^d:\n";
14 ffd9a51f 2023-08-04 jrmu my @lines = <STDIN>;
15 ffd9a51f 2023-08-04 jrmu @lines = reverse @lines;
16 ffd9a51f 2023-08-04 jrmu print @lines;