use Net::EmptyPort qw(check_port); my $errors = validator($data)->( on => '/ports/*', should => sub { @_ > 0 }, because => 'At least one port should be defined at "ports" section', each => sub { my $port = $_->value; shift->report_error("The port $port is not available for usage") if(!check_port($port)); } )->errors;