tailieunhanh - Perl in a Nutshell phần 3

là đúng, các nhà điều hành phạm vi vẫn đúng cho đến khi các toán hạng bên phải là sự thật, sau đó các nhà điều hành phạm vi trở nên sai lầm một lần nữa. Toán hạng bên phải không phải là đánh giá trong khi các nhà điều hành trong tình trạng sai lầm, | Chapter 4 Operators is true the range operator stays true until the right operand is true after which the range operator becomes false again. The right operand is not evaluated while the operator is in the false state and the left operand is not evaluated while the operator is in the true state. The alternate version of this operator . does not test the right operand immediately when the operator becomes true it waits until the next evaluation. Conditional operator Ternary is the conditional operator. It works much like an if-then-else statement but it can safely be embedded within other operations and functions. test_expr if_true_expr if_false_expr If the test_expr is true only the if_true_expr is evaluated. Otherwise only the if_false_expr is evaluated. Either way the value of the evaluated expression becomes the value of the entire expression. Comma operator In a list context is the list argument separator and inserts both its arguments into the list. In scalar context evaluates its left argument throws that value away then evaluates its right argument and returns that value. The operator is mostly just a synonym for the comma operator. It s useful for documenting arguments that come in pairs. It also forces any identifier to the left of it to be interpreted as a string. String operator The concatenation operator . is used to add strings together print abc . def prints abcdef print a . b concatenates the string values of a and b Binary x is the string repetition operator. In scalar context it returns a concatenated string consisting of the left operand repeated the number of times specified by the right operand. print - x 80 prints row of dashes print t x tab 8 x tab 8 tabs over In list context if the left operand is a list in parentheses the x works as a list replicator rather than a string replicator. This is useful for initializing all the elements of an array of indeterminate length to the same value @ones 1 x 80 a list of 80

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.