in reply to Noob's question
There is a newline character at the end of each line after you press ENTER.To remove this unwanted character, Perl has the chomp function which does the trick.
my $s=""; while(chomp($s.=<STDIN>)){print "$s\n"} [download]