in reply to Running complex sed from perl

If you change your delimiter from "#" to "!", it should work fine.