in reply to pipe output to perl

All together:

perl -pe '$_ = "XXX\n" . $_ . "XXX"' /tmp/file