http://www.perlmonks.org?node_id=199321

ok, it might not be that great, but it was a first for me.
perl -e '$_="p\#hjaja";s#ja(.*)#\b$1ph\n#;s#.\###;print;'

UPDATE: Changed all !s to # due to !! executing the previous command under tcsh