# Instead of using `not defined $word`, I force # non-whitespace into $word. # Still very ugly. # Still had to duplicate code `$word !~ /^\s*$/` my $word = 'JunkToPreventFailingTheFirstLoop'; while ( $word !~ /^\s*$/ ) { print 'Please enter a word: '; chomp($word = ); if ( $word !~ /^\s*$/ ) { print "You entered '$word'\n"; } }