As soon as $s contains a "true" value, your loop will not terminate because the loop condition will always be true.
trizen's suggestion doesn't do that because chomp returns the number of characters removed, which will be zero when end-of-file is reached on STDIN - but it won't terminate on a blank line, since that still has a newline character. Personally, I might have written it like this:
while(<STDIN>) { chomp; $s.=$_; print "$s\n"; }
However, putting the reading of STDIN in the condition of the while makes me suspect that you want to terminate the loop when an empty line is input. If that's what you want, here's one way to do that:
while(<STDIN>) { chomp; last unless length; $s.=$_; print "$s\n"; }
Also, often, using <> instead of <STDIN> can be helpful because it gives you the power of Perl's magic ARGV (see I/O Operators). Unless you explicitly want to read from STDIN, I'd suggest using <>. |