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.
精彩评论