Đang chuẩn bị liên kết để tải về tài liệu:
Minimal Perl For UNIX and Linux People 2

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Ví dụ: $ Cat exotic_fruits exotic_jerkies sung kiwi lạc đà python Bây giờ chúng ta sẽ kiểm tra một số chương trình Perl mà hành động như các bộ lọc giống như con mèo. Tại sao? Bởi vì sự đơn giản của con mèo được gọi là một bộ lọc null, vì nó không thay đổi đầu vào làm cho nó một điểm khởi đầu lý tưởng cho những khám phá của chúng ta về cơ sở xử lý dữ liệu của Perl. Dưới đây là một ví dụ về cách thi đua mèo với Perl, sử dụng một kịch bản mà. | For example cat exotic_fruits exotic_jerkies fig kiwi camel python Now we ll examine some Perl programs that act as cat-like filters. Why Because the simplicity of cat called a null filter since it doesn t change its input makes it an ideal starting point for our explorations of Perl s data-processing facilities. Here s an example of the hard way to emulate cat with Perl using a script that takes an unnecessarily complex approach usr bin perl -wl @ARGV or @ARGV - foreach my file @ARGV open IN file or die 0 Open of file failed code n while defined _ IN print _ close IN or die 0 Close of file failed code n Only masochists paranoiacs or programmers abused in their early years by the C language e.g. squared JAPHs would write a Perl program this way.7 That s because Perl provides facilities to automatically create the filtering infrastructure for you all you have to do is ask for it An equivalent yet considerably simpler approach is shown next. In this case Perl s input operator is used to automatically acquire data from filename arguments or STDIN as detailed in chapter 10 . Unlike the previous solution this cat-like program is small enough to implement as a one-liner perl -wl -e while print file file2 But even this is too much coding You re busy and typing is tiresome error-prone and likely to give you carpal tunnel syndrome so you should try to minimize it within reason . Accordingly the ideal solution to writing a basic filter program in Perl is the following which uses the n option perl -wnl -e print file file2 OPTIMALLY simple The beauty of this version is that it lets you focus on the filtering being implemented in the program which in this case is no filtering at all the program just prints every 7 There are cases where it makes sense to write your own loops in Perl as shown in chapter 10 but this isn t one of them. Writing one-line programs 13 1.7 line it reads. That s easy to see when you aren t distracted by a dozen lines of boilerplate input-reading code as

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.