my $input = <>; chomp($input); # remove trailing \n if ( $input eq "" ) { ... }