# Had to add `not defined $word` to handle the special case # during the first time through the loop. Very Ugly! # Had to duplicate code `$word !~ /^\s*$/` to prevent the # final ENTER from printing "You entered ''" as it exits # the loop. my $word; while ( ( not defined $word ) or ( $word !~ /^\s*$/ ) ) { print 'Please enter a word: '; chomp($word = ); if ( $word !~ /^\s*$/ ) { print "You entered '$word'\n"; } }