我有以下哈希结构
test => '/var/tmp $slot'
my $slot_number = 0; # just another variable.
然后我获取键的值并存储在一个名为 $test_command 的变量中
现在我需要用另一个名为的变量替换$slot
in
所以我正在尝试这个$test_command
$slot_number
$test_command =~ s/$slot/$slot_number/g; this does not work
$test_command =~ s/$slot/$slot_number/ee; does not work
$test_command =~ s/\$slot/\$slot_number/g; this does not work
预期输出应该是
$test_command = /var/tmp 0