while( my $input = <> ) { warn( "Bad input" ), next unless $input =~ m[...]; ... }