从perl脚本运行bsub命令

ibr*_*him 1 shell perl lsf

我试图通过以下方式从perl脚本运行bsub命令:

system ("bsub -select "testid::1" -q normal");
Run Code Online (Sandbox Code Playgroud)

但我认为perl因为双引号而变得混乱"testid::1".实现这个的正确方法是什么?

tri*_*eee 6

你可以逃避内部引号:

system ("bsub -select \"testid::1\" -q normal");
Run Code Online (Sandbox Code Playgroud)

或者用单引号替换外引号,或者实际上是任何字符,这要归功于qqPerl中的广义引号运算符,它恰好存在于这种场景中;

system (qq{bsub -select "testid::1" -q normal});
Run Code Online (Sandbox Code Playgroud)

有一个配套的通用单引号运算符q.