in reply to Reversing of list through STDIN

Hi gaurav,
...it should return the reverse of whatever the list has been entered by the user...

True if and only if the user didn't enter all the list on a single line on the CLI. Because with that the array will only have one "value". See what I mean below, using a modified toolic example.

use warnings; use strict; print "Enter some lines, then press Ctrl-D:\n"; # or maybe Ctrl-Z my @lines = <STDIN>; my @reverse_lines = reverse (@lines); print @reverse_lines; __END__ Enter some lines, then press Ctrl-D: 1 2 3 # entered by the user 1 2 3 # printed back
But if otherwise, your script should work as you intended.
Mine observation please.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^2: Reversing of list through STDIN
by gaurav (Sexton) on Jul 05, 2013 at 22:32 UTC

    Hi Monks, Sorry for being late. Another thing is, I have been typing all my inputs in a single line that's why not getting the desired result. But thanks to 2teez ,now I am getting right output. And thanks to all Of you for help me out this.