Actually I know that vim can embed perl. More to that, I, personally, write a number of vim scripts with perl, and found this technology extremely powerfull.
To say, I saw how someone implements in VIM script a bubble-sort, to save people from feeding lines to 'sort' external program (it is not always available).
Needless to say, this is just one line in Perl.
I do SGML stuff using Perl from inside VIM scripts, among other things.
But VIM probably do not allow step-by-step debugging like Emacs, due to its intention to be compact and not part of OS.
I saw somewhere that "emacs is a good OS but lacks editing capabilities"