This sounds to me like a very, very strange UI request. Normally a blank input from the user should be a no op or a re-prompt.
But I think this will do what you you have asked for although I'm not sure that this is what you need:
while ( (my $inputLine =<STDIN>) !~ /^\s*$/ )
{
print $inputLine;
}
print "WOW null line (only spaces or nothing) - I've bailed!\n";