Tuy nhiên, thông tin chứa đựng trong cuốn sách này được bán mà không có sự bảo đảm, thể hiện rõ ràng hay ngụ ý. Cả các tác giả, Wrox Press cũng không phải các đại lý hoặc nhà phân phối sẽ được tổ chức chịu trách nhiệm về bất kỳ thiệt hại gây ra hoặc | Operators Simpo PDF Merge and Split Unregistered Version - http Logical The logical operators perform Boolean operations returning 1 on success and 0 on failure. For instance this is a Boolean and operation true a b This returns 1 True if both a and b are True. The meaning of true and false in this context is quite flexible and we discuss it in more detail in the next chapter. For now though it is enough to say that Perl generally does the right thing with its operands so strings like 0 and are False and others are True while arrays and hashes are True if they have one or more elements and False if they have none. Numeric values are True if they have a value positive or negative and False if they are zero. Perl has two sets of logical operators one appearing as conventional logic symbols and the other appearing as named operations. These two sets are identical in operation but have different precedence AND Return True if operands are both True OR Return True if either operand is True xor Return True if only one operand is True NOT Unary Return True of operand is False The operator has a much higher precedence than even and so that expressions to the right of a almost always mean what they say value1 value2 adds result of value1 to value2 value1 value2 negates result of value1 value2 Conversely the not and or and xor operators have the lowest precedence of all Perl s operators with not being the highest of the four. This allows us to use them in expressions without adding extra parentheses ERROR evaluates Done exit which exits before the print is executed print Done exit correct - prints Done then exits print Done and exit All the logical operators excepting the unary not are efficient in that they always evaluate the lefthand operand first. If they can determine their final result purely from the left operand then the right is not even evaluated. For instance if the left operand of an or is True then the result must be True. Similarly if the left .