Blob


1 #!/usr/bin/perl
3 # Write a program that prompts for and reads a string and a number (on separate
4 # lines of input) and prints out the string the number of times indicated by
5 # the number of separate lines. (Hint: use the x operator.) If the user enters
6 # "fred" and "3", the output should be three lines, each saying "fred". If the
7 # user enters "fred" and "299792", there may be a lot of output.
9 use warnings;
10 use strict;
11 use utf8;
13 print "string = ";
14 my $str = <STDIN>;
15 print "repeat = ";
16 chomp(my $r = <STDIN>);
18 print $str x $r;