while (1) { print 'Please enter a word: '; chomp(my $word = ); last if $word =~ /^\s*$/; print "You entered '$word'\n"; }