open (A, '+<', "somefile.html") or die $!; s/a/b/g for my @records = ; seek(A, 0, 0); ### truncate (A, 0) or die "can not truncate file to zero length\n"; ### print A @records;