perl + 忽略 perl 中的“/”字符

Dia*_*ana 2 perl

我想用 America/Jamaica 替换字符串 America/Adak:

       perl -i -pe "s/$A/$B/"  /etc/sysconfig/clock 
Run Code Online (Sandbox Code Playgroud)

请建议需要在 perl 语法中更新什么?(问题是我有“/”所以需要忽略这个 uniq 字符,需要在我的 perl 语法中添加什么?

 A="America/Adak"
 B="America/Jamaica"
 CLOCK=/etc/sysconfig/clock

 perl -i -pe "s/$A/$B/" $CLOCK

 Bareword found where operator expected at -e line 1, near "s/America/Adak/America"
 syntax error at -e line 1, near "s/America/Adak/America"
 Execution of -e aborted due to compilation errors.

 more $CLOCK
 # The ZONE parameter is only evaluated by system-config-date.
 # The timezone of the system is defined by the contents of /etc/localtime.
 ZONE="America/Adak"
 UTC=true
 ARC=false
Run Code Online (Sandbox Code Playgroud)

Phi*_*ack 5

使用不同的分隔符,例如:

perl -i -pe "s|$A|$B|" $CLOCK
Run Code Online (Sandbox Code Playgroud)

请参阅perlre手册页。