Use of double negation (!!) [duplicate]
问题 This question already has answers here : What does !! (double exclamation point) mean? (3 answers) Closed 6 years ago . Okay so I came across a code which looks like @documents_names = sort { !!$deleted_documents_names{$a} == !!$deleted_documents_names{$b} ? uc($a) cmp uc($b) : !!$deleted_documents_names{$a} cmp !!$deleted_documents_names{$b} } @documents_names; It's the first time I'm seeing the use of double negation. What's the use of it? When would a person use it? 回答1: It converts non