Skip to Content
Perl语言入门(第8版)
book

Perl语言入门(第8版)

by Randal L. Schwartz, brian d foy, Tom Phoenix
October 2022
Beginner to intermediate
390 pages
7h 5m
Chinese
Southeast University Press
Content preview from Perl语言入门(第8版)
236
12
习题
以下习题答案参见第
326
页上的“第
12
章习题解答”一节:
1. [15]
编写程序,从命令行取得一串文件名,并汇报这些文件是否可读、可写、可
执行以及是否确实存在。(提示:如果你可以写一个函数,一次做完这些测试会
很方便。)如果文件先被
chmod
0
,你的程序会汇报什么?(也就是说,如果
你使用
Unix
系统,
chmod 0 some_file
这样的命令就会把文件标示成不可读、不
可写也不可执行。)在大部分
shell
下,用星号作为参数,代表当前目录下的所
有文件。也就是说,你可以用
./ex12-2 *
这样的命令来向程序一次询问多个要
测试文件的属性。
2. [10]
编写程序,从命令行参数指定的文件中找出最旧的文件并且以天数汇报它已
存在了多久。若列表是空的(也就是命令行中没有提及任何文件),那么它该做
什么?
3. [10]
编写程序,用栈式文件测试操作符列出命令行参数指定的所有文件,看看拥
有者是否是你自己,以及它们是否可读、可写。
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Go程序设计语言

Go程序设计语言

艾伦A. A.多诺万, 布莱恩W. 柯尼汉
Perl语言入门

Perl语言入门

Randal L. Schwartz, brian d foy, Tom Phoenix

Publisher Resources

ISBN: 9787576602036