in reply to
Simple Search and Replace?
The assignment of file contents to an array surely depends on the size of the file .The file , if it has a larger size will consume whole of the memory either dumping core or exiting out with some untrappable error. Hence people tend to use while to read and print in the write file
$_ =~ s///g;
print WriteData "$_";
The read os data if it is small in size you could set $/ = undef;
and slurp the file contents to a ascalar variable itself and then do the regular expression on it .