Or use Tie::File as suggested in this related node: "Re: Use of grep and foreach"
In reply to Re: Re: Updating a text file by crouchingpenguin in thread Updating a text file by kirk123