Is there a library function or what is the best way to replace the contents of a file between two markers with perl of course =) like: <!-- beginning --> Replace all of this crap with new contents. from the This_might_be_better.txt file <!--end -->