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版)
标量数据
31
要知道,逗号在
Perl
里还有更加重要的作用(请阅读第
3
章),所以为了避免歧义,
我们改用下划线。再说了,也不是所有国家和地区都用逗号分隔千位的。
非十进制整数的直接量
和许多其他编程语言一样,除了十进制(
decimal
,基数为
10
)以外,
Perl
也可以用其
他进制来表示数字直接量。八进制(
octal
,基数为
8
)直接量以
0
开头,后跟数字
0
7:
0377 #
等于十进制的
255
v5.34
开始,还可以用
0o
作为八进制数的前导标志,这使八进制数与你将要看到的
其他基数保持一致:
0o377 #
等于十进制的
255
十六进制(
hexadecimal
,基数为
16
)直接量以
0x
开头,后跟数字
0
9
以及字
A
F
(或者小写字母
a
f
)表示十进制中
0
15
的值:
0xff #
或者用大写
FF
,也等于十进制的
255
二进制(
binary
,基数为
2
)直接量以
0b
开头,后跟数字
0
1
0b11111111 #
等于十进制的
255
虽然这三个数字的写法不同,但对
Perl
来说都是同一个数字。所以写成
0377
也好,
写成
0xFF
也罢,都表示数字
255
。选择哪种书写形式,取决于参与运算的需要。例如
许多
Unix
系统中的
shell
命令惯用八进制数字,所以在第
12
章和第
13
章会看到
Perl
里面八进制数字形式的示例。
前导
0
的写法只用于表示数字直接量,不能用于字符串和数字间的自动转换。 ...
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