my $answer; print "Enter your text: (type END to exit)\n"; while () { last if /^END$/; $answer .= $_; }