KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a question about using "//" operator, my testing code is as following: perl -e '@arr1=();@arr2=(1,2,3);@arr3=defined(@arr1)?@arr1:@arr2;print "[@arr3]\n"' [1 2 3] perl -e '@arr1=();@arr2=(1,2,3);@arr3=@arr1//@arr2;print "[@arr3]\n"' [0] perl -e '$v1=();$v2="123";$v3=defined($v1)?$v1:$v2;print "[$v3]\n"' [123] perl -e '$v1=();$v2="123";$v3=$v1//$v2;print "[$v3]\n"' [123] my question is, why do using "//" operator give the same results as using "defined()? : " on the scalar, but not array(or hash)? Thanks!!!
Tags (comma-separated)
Save Edits
Cancel