为什么版本1,2和3工作,但版本4失败时:Null regex not allowed
在多行上使用//
?
#1
say Nil //
try {'a'++} //
1;
#2
say Nil
// try {'a'++} //
2;
#3
say Nil
// 3;
#Fails with: Null regex not allowed
say Nil
// try {'a'++}
// 4;
在一条线的末端有try
块。它是一样的
say Nil
// try {'a'++};
// 4;
参见文档:It is OK to skip the semicolon between the last statement in a block and the closing }
.
你可以试试
say Nil
// try {'a'++}\
// 4;
要么
say Nil
// (try {'a'++})
// 4;