tailieunhanh - Minimal Perl For UNIX and Linux People 6
Tham khảo tài liệu 'minimal perl for unix and linux people 6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The double quotes around the argument are processed first forming a string from the space-separated list elements then the list context provided by the function is applied to that result. But a quoted string is a scalar and list context doesn t affect scalars so the existing string is left unmodified as print s argument. The join function listed in table provides the same service as the combination of and double quotes and is provided as a convenience for those who prefer to pass arguments to a function rather than to set a variable and double quote a string. We ll discuss this function later in this chapter. Now you understand the basic principles of evaluation context and the tools used for converting data types. With this background in mind we ll examine some important Perl functions that deal with scalar data next such as split. Then in section we ll discuss functions that deal with list data such as join. Programming with functions that GENERATE OR process scalars Table describes some especially useful built-in functions that generate or process scalar values which weren t already discussed in part 1. Table Useful Perl functions for scalars and their nearest relatives in Unix Perl built-in function Unix relative s Purpose Effects split The cut command AWK s split function the Shell s IFS variable Converting scalars to lists Takes a string and optionally a set of delimiters and extracts and returns the delimited default delimiter is any sequence of whitespace characters. localtime The date command Accessing current date and time Returns a string that resembles the output of the Unix date command. stat The ls -lL command Accessing file Provides information about the file lstat The ls -l command information referred to by stat s argument or the symbolic link presented as lstat s argument. chomp N A Removing newlines in data Removes trailing input record separators from strings using newline as the default. With Unix utilities .
đang nạp các trang xem trước