$regex = qr/--/ if($thestring =~ $regex || $thestring !~ $regex) { unshift(@match, $thestring); } #### 081407 start up server 081407 -- fatal error in procedure 1 081407 -- disconnected user 081407 -- logging started 081407 -- not enough space #### 081407 -- fatal error in procedure 1 081407 -- not enough space #### 081407 -- disconnected user 081407 -- logging started #### 1. get all occurrences of "--". 2. in those occurrences of "--" ignore those that have "logging" and "disconnected" could it be place in a qr// function like: qr/-- || ~! logging,disconnected/ (wrong syntax of course) something like an ignore list.