in reply to Search and Extract from String

Hi madbee,
There are several ways you can use to make this happen. Though following your "outline" could make it make ( I didn't try it), but using regex could also do this:

use warnings; use strict; while(<DATA>){ if(/controlled/i){ if(/(?<=a)\s(.+?)-?(?=controlled)/i){ #NOTE HERE print $1,$/; } } } __DATA__ This is a design-controlled string This is a design controlled string
..produces...
design design
NOTE: This might not be a generic solution, simply because am using OP data.
Please see Using Look-ahead and Look-behind
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me