in reply to map DBI results

While you haven't told us exactly what problems you are running into, I strongly suspect that this is it:

map { s/$term/"<i>$term</i>"/ } ...

Camel 3rd Ed p152 gives us:

"The return value of an s/// operation (in scalar or list contexts alike) is the number of times it succeeded ..."

You may want to consider something like this:
map { s/$term/"<i>$term</i>"/; $_; } ...