print "Type input (hit just enter when done):\n"; while (<>) { chomp; last unless length; # validate/store input here }