in reply to pattern match
Look for word boundaries.
$line = $. if (m/\b$complex\b/); [download]
"The first rule of Perl club is you do not talk about Perl club." -- Chip Salzenberg