my @failures = grep { !/$regex/ } @array; if ( @failures ) { warn "Validation failure. Bad names: @failures\n"; }