use strict; use warnings; my $input_object = { foo => 11, bar => '1234', }; my $self; if ( ( !defined $input_object ) or ( $input_object->{foo} > 10 ) or ( $input_object->{bar} !~ m/^\d{3}$/ ) ) { self->redirect('error'); }