How to kill some runnin perl script from bash script?

aim is to kill this script after 120 seconds of running and saving its output to a file. but my command not working and appears not killing the process.

#!/bin/sh
set -ex

while read domain;do
output=$(/root/tra*/script.pl $domain & pid=$!
sleep 120
pkill -f $domain)
echo "something"
echo "$output" > $domain_outputfile.txt
cat $domain_outputfile.txt
done < domains.txt

any idea why the command is not killed?