【发布时间】:2018-09-29 23:17:48
【问题描述】:
#!/usr/bin/perl
$test ="@test=hello"; #(Actually am reading this text from File and assigning to a variable)
print "$test";
执行上述代码后perl输出如下
输出:
=hello instead of @test=hello.
谁能解释一下上面的内容。我相信它被认为是空数组,但是在读取文件时如何避免这种情况,请消除我的误解。
谢谢,
【问题讨论】:
-
你可以在@前面加一个反斜杠或者用单引号代替双引号