好的,我得到了一个相当简单的(至少看起来很简单)。我有一个多行字符串,我只是在用其他东西替换不同的单词。让我演示给你看...
#!/usr/bin/perl -w
use strict;
$_ = "That is my coat.\nCoats are very expensive.";
s/coat/Hat/igm;
print;
输出将是
That is my Hat
Hats are very expensive...
第一行的“帽子”不应该大写。是否有任何技巧可以使外壳符合英语的书写方式?谢谢 :)