例如:输入数字= 10101001输出数字= 01010110
我试过$string = ~s / 1/0 /;和反向功能,但是没有给我正确的输出.
有人可以帮我吗.
my $str = '10101001'; $s =~ tr/01/10/; print "$s\n";
输出:
01010110