You sure can, see this post for editing in place using grep and Tie::File.
In reply to Re: Re: Use of grep and foreach by crouchingpenguin in thread Use of grep and foreach by monaLisa