Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个错误代码:
Invalid conversion in printf: "%A"' printing %A characters in a URL
这是我的代码:
$url =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg; printf "%-10s $url\n", $res_request{$key};
我怎样才能解决这个问题?
非常感谢,艾尔
不要放入$url格式字符串,而是使用%s格式:
$url
%s
printf "%-10s %s\n", $res_request{$key}, $url;
(您不应该将变量插入到具有可能被误认为格式化代码的部分的格式字符串中。)