开发者

What's wrong when running commandline perl here?

[root@dev-test test]$ perl -e "%hash=(key,1);print 1 if exists $hash{key};"
exists argument is n开发者_如何学Cot a HASH or ARRAY element at -e line 1.

The above works if I put it in a file,but why command line fails?


$hash is being treated by the shell as a variable.


Works for me (windows). Perhaps in your OS you need to use single quotes? Looks like linux/unix, and double quotes expand variables prefixed with the $ dollar sign.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜