The translation respects the original and maximizes the original content in its own way.
For more information, please visit www.from0701.com. Two chapters are updated weekly.
Welcome to the next stage of Perl learning. The reason you're here may be that you want to write more than 100 lines of code or just that your boss is asking you to. Our "Getting Started with Perl" is so great because he describes how to write small and medium-sized programs in Perl (which in our view is the most common use of Perl). But in order not to let our "little camel book" too thick, we deliberately and carefully removed a lot of content. Next, we will continue our story in the same style as the little camel book. This includes the knowledge needed to write 100-10000 lines (and perhaps more) of the code. For example, you can learn how to add multiple programs to a project by writing a reusable Perl module. This is great unless you work 35 hours a day and don't let you need help from others to accomplish larger tasks. In large projects you also have to ensure the versatility of each part of the code. This book will also show you how to handle complex data structures, such as "multidimensional hashes" or "hash arrays" that we might arbitrarily say. Once you have a bit of knowledge about references, you're on the path to dealing with complex data structures, which can make your life a lot easier. We'll also give you a brief introduction to object-oriented programming, which allows your code to be used multiple times. The important aspects of Team programming are version control and unit testing. You will learn the most basic program packaging and unit testing. As we promised in the little camel book, we will attract you with interesting examples. Although we sent Fred,barney,betty and Wilma home, the new characters will become our star character.
What should we know already?
Let's say you've read the Little camel book, and at least the fifth edition, or at least pretend you did, and you've done enough exercises to master the basics. For example, you won't see an explanation of how to select an array element or return a value from a child function in this book. Make sure you've mastered the content, and all these little camel books are:
- How to run a Perl program in your system
- Basic Perl variable types: scalar, array, and hash
- Control structures, such as while,if,for and foreach
- Sub-Program
- Basic Regular Expressions
- List operators, like Grep,map,sort and print
- File control like file open, file read,-X (file test)
You may see a deeper discussion of these topics in this book, but let's assume you already know the basics. The final part of this book discusses publishing and contributing programs to CPAN. You first need to apply for a pause account, url: http://pause.perl.org/pause/query?ACTION=request_id.
Strict and warnings
We introduced strict and warnings in the small camel book, and we want you to use it in all your code. Most of the code you see in this book opens strict and warnings by default, so we omit the duplicate code as we omit the #!/usr/bin/perl (Perl interpreter location). We also include these when we demonstrate a complete program. You may want to do what we do. Instead of editing from scratch, you can open a template that contains generic code. Before you develop your own templates, complete standard documents, and find the best way to do things, you can use a simple, hypothetical code that wraps your program: #!/usr/local/bin/perl
Use strict;
Use warnings;
__end__
Perl v5.14
This book is updated with new features of perl5.14 and its subsequent versions. Generally, the underlying language is stable in every version. Some of the modules we use may be updated, especially those that are released with Perl. So we usually show Perl the basic point of view, simply browse the module, you should look at the module reference manual before using the module. Some of the new features require that we explicitly declare that they also apply to earlier versions. The earliest way is to tell Perl which version we need to use. The number 5.014 needs to have three digits after the decimal point:
Use 5.014;
Say "Hello world";
You can also write in the following two ways:
Use v5.14.2;
Use 5.14.2;
Whenever we want to use some specific version of the feature to write code, we insert a row like using v5.14.2 to ensure that the feature is available. If possible we will also show an older version of the available code. We think Perl 5.8, released in 2002, is the earliest version that everyone should use. Usually, we try to write a code that runs as much as possible in a larger version, but we also want to be in the same time as you. For more information about perl5.14, please refer to the Little Camel Book Sixth edition.
Perl Advanced Chinese Version First chapter introduction