>>150

ご意見有難うございます。
ファイルを一番最後に入れるとできるということがわかりました。

perl -i -spe 's/AA/$var/; END{print "complated.\n"}' -- -var="BB" /home/xxx/aaa.txt