$results = $dbh->selectall_arrayref("SELECT ID, sentence FROM texts WHERE sentence LIKE '%$query%'" #### $results = $dbh->selectall_arrayref("SELECT ID, sentence FROM texts WHERE sentence LIKE ' %$query% '" <\code>

Of course it doesn't work as I expected: $query="tag" sentence1= "Put tags around your paragraphs" sentence2= "Put a tag around your paragraphs" sentence3= "I am tagging your paragraphs" sentence4= "There are many advantages"