There's one caveat to be aware of with doing a "@array = <FILEHANDLE>" type of file read. If you end up having to work with very large files (or you don't have a whole lot of RAM to work with), you could be slowing down your program, maybe drastically if you try to load the entire file into memory at once, which is what the code below will do. Also, you are chomp()ing the array that has the contents of your file, but then you are reading from the file handle line by line when you proceed to the "while(<HANDLE>){" statement. Get rid of the @filecontents variable altogether. As a matter of fact, even the chomp is extranneous to your mission of substituting characters. Try this version, and see if you can tell where I've done things a bit differently.
######################### use strict; my $file = "/path/to/my/file.txt"; #open file for reading open(FILE,"<$file") || die "Could not open file for reading! $!"; #open file for writing open(TEMP,">$file.tmp") || die "Could not open file for writing! $!"; while(<FILE>){ #for each line read, replace text $_ =~ s/find/replace/gi; #print result to temp file print TEMP $_; } #should happen automatically, but just for good measure... close FILE || die "Could not close file! $!"; close TEMP || die "Could not close file! $!"; #remove the old file unlink $file; #rename the temp file to the old file's name rename("$file.tmp",$file) || die "The file could not be renamed! $!"; ######################### -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]