in reply to Re^4: matching multiple words within multiple lines in a file
in thread matching multiple words within multiple lines in a file

In my opinion, the link to Parsing a file with parentheses to build a hash is relatively suitable, as it points to a very similar problem, extracting terms between ( and ) instead of { and }.

Depending on the nature of your data, you might be able to simply extract all pairs of {...} and then check those for your keywords. A very simplicistic parser would be:

my $line= 'abc ... {abc} ... abc'; my @terms= $line =~ /\{(.*?)\}/g; for my $bracketed (@terms) { print "$bracketed matches $1" if ($bracketed =~ /(abc|nop)/); };

This does not care for nested sets of brackets. For parsing nested sets, see the linked node.