Revert "Use sed instead of perl"

This reverts commit 3d8f7a4ae1223bb6d0ed688f83d8c82a701cd1e1.