for $term ( @$inputs ) { while ( /\b$term\b/g ) { ... } }