Beginning Perl Third Edition PHẦN 2

Bạn đã sử dụng lưới kiểm soát nhiều lần đã có trong chương này, nhưng trong mọi trường hợp, bạn sử dụng một lưới với một hàng duy nhất và một cột duy nhất. Để thêm các hàng và cột, bạn phải sử dụng RowDefinitions và ColumnDefinitions thuộc tính, | CHAPTER 2 SCALARS When Perl reads your program it reads and understands numbers in any of the allowed number systems 0 for octal 0b for binary and 0x for hex. What happens you might ask if you specify a number in the wrong system Well let s try it out. Edit to give you a new program which looks like this usr bin perl use warnings print 255 n print 0378 n print 0b11111112 n print 0xFG n Since octal digits only run from 0 to 7 binary digits from 0 to 1 and hex digits from 0 to F none of the last three lines make any sense. Let s see what Perl makes of it perl Bareword found where operator expected at line 9 near 0xFG Missing operator before G Illegal octal digit 8 at line 7 at end of line Illegal binary digit 2 at line 8 at end of line syntax error at line 9 near 0xFG Execution of aborted due to compilation errors. Now let s match those errors up with the relevant lines Illegal octal digit 8 at line 7 at end of line And line 7 is print 0378 n As you can see Perl thought it was dealing with an octal number but then along came an 8 which is not a legal octal digit so Perl quite rightly complained. The same thing happened on the next line Illegal binary digit 2 at line 8 at end of line And line 8 is print 0b11111112 n The problem with the next line is even bigger Bareword found where operator expected at line 9 near 0xFG Missing operator before G syntax error at line 9 near 0xFG The line starting Bareword is a warning because we included use warnings . A bareword is a series of characters outside of a string that Perl doesn t recognize. Those characters could mean a number of things and Perl is usually quite good at understanding what you mean. In this case the bareword was G Perl understood 0xF but couldn t see how the G fit in. We might have wanted an operator do something with it but there was no operator. In the end Perl .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
106    119    3    30-06-2024
Đã 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.