grep a specific strings in a Perl array -
how grep multiple sets of 5 characters in order in array in perl program? @arr2 = grep(/[bcrz]+/, @arr1); @arr1 can contain crzbbztccbbrz fjdlsfjslfjs crzbbzccbbrz only lines last should taken if want lines contain 5 chars , none others, regex like: /^[brczw]+$/ looks strings containing 1 or more of 5-character set, containing no other characters. might more efficient @carol's solution using grep(). uses regex determine if string has of unwanted characters, , rejects line.