【发布时间】:2016-08-30 13:07:14
【问题描述】:
我有以下多行字符串。我不能让它成为一行,因为它来自命令输出。例如:
my $myString = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a
type specimen book. It has survived not only five centuries, but also
the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s"
我想去掉包括“scrambled”这个词在内的东西
我在下面尝试过,但似乎不起作用。
if($myString =~ 's/.*(scrambled)//s')
{
print "Match: <$&>\n";
}
【问题讨论】: