Picking Up Perl

This book is not to assume that no prior knowledge of Perl. … Programming Perl. This book covers the basic data and control structures of Perl, as ….

More PDF Content

Picking Up Perl
Preface… 1
Purpose of this Book … 1
Acknowledgments … 1
Obtaining the Most Recent Version… 1
Audience … 1
Material Covered… 1
Conventions Used in this Book … 2
1 Getting Started… 3
1.1 A First Perl Program… 3
1.2 Expressions, Statements, and Side-Effects … 5
2 Working with Scalars … 7
2.1 Strings … 7
2.1.1 Single-quoted Strings … 7
2.1.1.1 Special Characters in Single-quoted Strings… 8
2.1.1.2 Newlines in Single-quoted Strings… 9
2.1.1.3 Examples of Invalid Single-quoted Strings … 9
2.1.2 A Digression—The print Function … 10
2.1.3 Double-quoted Strings … 11
2.1.3.1 Interpolation in Double-quoted Strings.. 11
2.1.3.2 Examples of Interpolation … 12
2.1.3.3 Examples of Interpolation (ASCII Octal Values)… 12
2.1.3.4 Examples of Interpolation (ASCII Hex Values)… 13
2.1.3.5 Characters Requiring Special Consideration … 14
2.2 Numbers … 14
2.2.1 Numeric Literals… 14
2.2.1.1 Printing Numeric Literals… 15
2.3 Scalar Variables… 15
2.3.1 Scalar Interpolation… 16
2.3.2 Undefined Variables… 18
2.4 Operators … 21
2.4.1 Numerical Operators… 21
2.4.2 Comparison Operators … 22
2.4.3 Auto-Increment and Decrement… 23
2.4.4 String Operators … 23
2.4.5 Assignment with Operators… 23
2.5 Output of Scalar Data… 23
2.6 Special Variables … 24
2.7 Summary of Scalar Operators … 24
3 Arrays … 25
3.1 The Semantics of Arrays… 25
3.2 List Literals … 25
3.3 Array Variables … 26
3.3.1 Array Variables… 26
3.3.2 Associated Scalars … 27
3.4 Manipulating Arrays and Lists … 27
3.4.1 It Slices! … 27
3.4.2 Functions … 28
3.4.2.1 Arrays as Stacks … 28
3.4.2.2 Arrays as Queues … 28
3.4.3 The Context—List vs. Scalar… 29
3.4.4 Array Interpolation … 29
4 Control Structures… 31
4.1 Blocks… 31
4.2 A Digression—Truth Values… 31
4.3 The if/unless Structures … 32
4.4 The while/until Structures … 33
4.5 The do while/until Structures … 33
4.6 The for Structure … 33
4.7 The foreach Structure … 34
5 Associative Arrays (Hashes)… 35
5.1 What Is It?… 35
5.2 Variables … 35
5.3 Literals… 35
5.4 Functions… 36
5.4.1 Keys and Values… 36
5.4.2 Each… 36
5.5 Slices… 37
5.6 Context Considerations … 37
6 Regular Expressions … 39
6.1 The Theory Behind It All… 39
6.2 The Simple … 39
6.2.1 Simple Characters … 39
6.2.2 The * Special Character… 40
6.2.3 The . Character … 40
6.2.4 The | Character… 40
6.2.5 Grouping with ()s … 40
6.2.6 The Anchor Characters … 40
6.3 Pattern Matching … 41
6.4 Regular Expression Shortcuts … 41
7 Subroutines … 43
7.1 Defining Subroutines … 43
7.2 Returning Values… 43
7.3 Using Arguments… 43
Appendix A Background of Perl… 45
A.1 A Brief History of Perl … 45
A.2 Perl as a Natural Language… 46
A.3 The Slogans… 46
Appendix B GNU Free Documentation License … 49
B.1 ADDENDUM: How to use this License for your documents … 55
General Index … 57

Download Picking Up Perl pdf from www.ebb.org, 66 pages, 354.86KB.
Related Books

Leave a Reply