Red Viper has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I am learning to use arrays with the lama book. One of the questions reads: "Write a program that reads a list of strings on separate lines until end-of-input and prints out the list in reverse order". The most recommended answer at the end of the book is the code below:
print "Enter some lines, the press Ctrl-D:\n"; print reverse <STDIN>;
I entered that code into strawberry perl,and that code didn't work. and when I tried to use Ctrl D the output was this "^D". Why isn't the answer code working and how do I write the proper code for the question?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Arrays and the Llama Book
by davido (Cardinal) on Aug 07, 2014 at 04:13 UTC | |
by AnomalousMonk (Archbishop) on Aug 07, 2014 at 09:21 UTC | |
|
Re: Arrays and the Llama Book
by Athanasius (Archbishop) on Aug 07, 2014 at 07:30 UTC | |
|
Re: Arrays and the Llama Book
by NetWallah (Canon) on Aug 07, 2014 at 04:14 UTC | |
|
Re: Arrays and the Llama Book
by Red Viper (Novice) on Aug 09, 2014 at 04:17 UTC |