You use printf there, and it considers its first argument to be a format string. See printf documentation for more details. When I encounter such a problem, I always guarantee that I use the functions correctly. :)
You probably want just print :
print FILE $content;
In your example, you do not need to read the entire file, since your substitution does not cross the lines. Instead of trying to read and write the same file name at the same time, use a temporary file:
open my($in), "<", $file or die "cannot open file $file\n"; open my($out), ">", "$file.bak" or die "cannot open file $file.bak\n"; while( <$in> ) { s{status=["'][\w ]*["']\s*}{}gi; print $out; } rename "$file.bak", $file or die "Could not rename file\n";
It also comes down to this command line program:
% perl -pi.bak -e 's{status=["\']\\w ]*["\']\\s*}{}g' file
source share