in reply to Extract words from brackets

Sounds like a case for Text::Balanced.