in reply to Replacing text inside lots of files

To replace text (if you know the place) easiest way is to use 's///'. In this case (last 10 letters).
# expecting that $file has file name. open (INF,"$file") or die "Unable to open \'$file\': $!"; open (OUTF,".temp_file") or die "Unable to create temp file: $!"; my $line=readline(INF); chomp($line); # if windows remember to $line=~s/\r$//o; # now change the last 10 characters from first line $line=~s/.{10}$/$file/; print "$line\n"; # this reads every line in file and prints it as is while (<INF>) { print OUTF "$_"; } rename (".temp_file","$file");


Update
Forgot to remove the '.wra' part from what is written in file. So to fix that add following between $line substitution and print.
# remove all the character after last dot $line=~s/\.\w+$//o;