use perl instead of sed