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 asks the user to enter a list of strings on separate
4 ffd9a51f 2023-08-04 jrmu #lines, printing each string in a right-justified, 20-character column. To be
5 ffd9a51f 2023-08-04 jrmu #certain that the output is in the proper columns, print a "ruler line" of
6 ffd9a51f 2023-08-04 jrmu #digits as well. (This is simply a debugging aid.) Make sure that you're not
7 ffd9a51f 2023-08-04 jrmu #using a 19-character column by mistake! For example, entering hello, good-bye
8 ffd9a51f 2023-08-04 jrmu #should give output something like this:
9 ffd9a51f 2023-08-04 jrmu
10 ffd9a51f 2023-08-04 jrmu #12345678901234567890123456789012345678901234567890
11 ffd9a51f 2023-08-04 jrmu # hello
12 ffd9a51f 2023-08-04 jrmu # good-bye
13 ffd9a51f 2023-08-04 jrmu
14 ffd9a51f 2023-08-04 jrmu
15 ffd9a51f 2023-08-04 jrmu use v5.10;
16 ffd9a51f 2023-08-04 jrmu use warnings;
17 ffd9a51f 2023-08-04 jrmu use strict;
18 ffd9a51f 2023-08-04 jrmu use utf8;
19 ffd9a51f 2023-08-04 jrmu
20 ffd9a51f 2023-08-04 jrmu chomp(my @lines = <>);
21 ffd9a51f 2023-08-04 jrmu print "1234567890"x7 ."\n";
22 ffd9a51f 2023-08-04 jrmu printf "%20s\n"x@lines, @lines;