perl -e 'sub foo {return qq|abracadabra|}; my $line = qq|hi there: sub|; if($line=~s/sub/&foo/eg){print $line};'