in reply to regex man they are tough

Is this what you want?

foreach $i (@n) { my ( $first_sixteen ) = $i =~ /^\s*(\d{16})/; my ( $pre, $post ) = $i =~ /(.{30})Some search string(.{30})/; warn "something not right with $i\n", next if grep !defined $_, $first_sixteen, $pre, $post; # do something with $first_sixteen, $pre, $post }

the lowliest monk