问题 I need to replace every occurrence of http:// with // in a file. The file may be (at least) in UTF-8 , CP1251 , or CP1255 . Does the following work? use File::Slurp; my $Text = read_file($File, binmode=>':raw'); $Text =~ s{http://}{//}gi; write_file($File, {atomic=>1, binmode=>':raw'}, $Text); It seems correct, but I need to be sure that the file will not be damaged whatever encoding it has. Please help me to be sure. 回答1: This answer won't make you sure, though I hope it can help. I don't