in reply to ^ to :
What you have described is correct, given the lack of context. Are you writing out the files afterwards? Have you done any before/after comparisons on $_?
Could you post a more complete code sample?