in reply to Minimisation of codes (if grep {})
Maybe you want to learn about the "else" keyword? perlsyn.