This is an advance chapter of Learning Perl 6 by Randal L. Schwartz and brian d foy. It is incomplete and may contain merely notes or an outline for future work. It may also contain sections of their writing from other sources, although these are noted where possible.

This work is copyrighted under a contract between O'Reilly Media and the authors, and you cannot repost it or distribute it without permission.

Scalars

Literal Values

Literal values are the things we type directly into our programs.

Numbers

Inf NaN

~~ ===

Int Int|Str

print say

.fmt( '' );

base 2, 8, 10, 16

adverbs

:base;

:base

Strings

\d42 \d[42] \o \x

\x[20, 32, 15] multiple characters

q//

qq//

Scalar Variables

Perl prefaces its variable names with sigils, or special character, to denote their type, but also to set them apart from everything else in the language. Since every variable name starts with a sigil, they will never conflict with a keyword, subroutine name, or other program element. That is, we do not have to know everything about the language to choose our variable names.

The rules for variable names (of all types, not just scalars) say that my indentifier (that's the name without the sigil) has to

strict mode on my default

scoping

Differences from Perl 5

0777 form out sigils invariant adverbs no more \177 or \0177 identifier names relaxed, no reserved names

Summary

Further Reading

Exercises