Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Ngoài những nhà khai thác cơ bản, Perl cũng hỗ trợ một số chức năng lấp đầy khoảng trống. Nếu không có ngoại lệ, tất cả các chức năng này tự động sử dụng giá trị của $ _ nếu bạn không xác định một biến mà trên đó để hoạt động. | 210 Perl The Complete Reference Most software is written to work with and modify data in one format or another. Perl was originally designed as a system for processing logs and summarizing and reporting on the information. Because of this focus a large proportion of the functions built into Perl are dedicated to the extraction and recombination of information. For example Perl includes functions for splitting a line by a sequence of delimiters and it can recombine the line later using a different set. If you can t do what you want with the built-in functions then Perl also provides a mechanism for regular expressions. We can use a regular expression to extract information or as an advanced search and replace tool and as a transliteration tool for converting or stripping individual characters from a string. In this chapter we re going to concentrate on the data-manipulation features built into Perl from the basics of numerical calculations through to basic string handling. We ll also look at the regular expression mechanism and how it works and integrates into the Perl language. We ll also take the opportunity to look at the Unicode character system. Unicode is a standard for displaying strings that supports not only the ASCII standard which represents characters by a single byte but also provides support for multibyte characters including those with accents and also those in non-Latin character sets such as Greek and kanji as used in the far east . Z 7 I Working with Numbers The core numerical ability of Perl is supported through the standard operators that you should be familiar with. For example all of the following expressions return the sort of values you would expect result 3 4 ftoc 212-32 5 9 square 16 2 Beyond these basic operators Perl also supports a number of functions that fill in the gaps. Without exception all of these functions automatically use the value of _ if you fail to specify a variable on which to operate. abs the Absolute Value When you are .