I can finally get this masterpiece. It was because of the second edition, so I purchased this small camel book without hesitation. However, when I just got, I have been suspected to be a final book, because the second version of the first chapter is very beautiful, and a simple example gradually expands, and finally goes to a 1, 2 hundred lines. It is very introduced to win, this time I want to relive but there is no chance. The first chapter is entirely related to some perl. Only a 5-line small example is listed in the end. Although it feels suddenly declining, but the enthusiasm of Perl is not reduced, but it is still necessary to take a book from the head to learn, and I don't want to write a book every time I write. Although I can complete the task but I can't remember. Now, I am determined that I have been here. I hope to end this book! Tell nonsense, start learning!
I don't start from programs, first talk about people who learn Perl must know. Inventor of Perl: Larry Wall. This is a very enthusiastic person. I have always dominate the Mailist, often see the problem of Larry Wall answering a lot of enthusiasts, and the language is simple, humorous. People who believe that Maillist will have been moved. And he guarantees that Perl will be free forever! How can he do not support him and cute perl! It is also necessary to be CPAN, "big store" in this Perl community. Inside all of the Perl's source code, the source code of the Perl itself, the two-input perl, example, document, and Perl extension (almost all PerL modules) and message files about Perl. The URL is: http://www.cpan.org/, of course our Linux community also has his mirror site: http://cpan.linuxForum.net/. There is also the last point I want to talk, Perl doesn't need to be compiled after C, C , Java, can be executed. Perl only needs to let him join the executable permissions to run your program. Ok, put the pads, these, more than the book is more simple, ^ _ ^. The first chapter has 2 programs, the first is the famous Hello World. I didn't want to write here, but for integrity, he also wrote him:
Example 1: #! / Usr / local / bin / perl -wprint "Hello, World! / N"; very simple, the real program is a line (second line). The first line is written by each Perl program. As for Perl where you are, you can use Which or whereis to find. Generally in / usr / bin / perl or / usr / local / bin / perl. And -W is my own habit. This is a very good parameter, he will point out where your program does not standardize the need to pay attention. It is recommended that you add it. Only if there is no harm ^ _ ^. The second sentence I think everyone can understand. (/ N is a powerful thing)
Example 2: #! / Usr / local / bin / perl -w @ lines = `perldoc -u -f atan2`; foreach (@lines) {s // w <(^ ^>] )> // u $ 1 / g; print;} This example is very perl tastes. A big pile makes you dizzy. I don't want to explain this example, because I am involved in too much knowledge, I put it out just to look at the results of the program: Take a look at everyone is enough to be strong enough ^ _ ^. One thing to point out that the second line is not a single quotes, but the anti-quotes, can put the shell command! Let's talk about Perldoc: it is specifically used to read and display Perl's document, related extensions, and utilities. To see the execution results of Perldoc -u -f atan2: BASH-2.05 $ perldoc -u -f atan2 = item atan2 y, xreturns the arctangent of y / x in the range -pi to pi.
For the Tangent Operation, You May Use the c
Function, or use the family:
Sub Tan {sin ($ _ [0]) / cos ($ _ [0])}
Finally, look at the program execution results: BASH-2.05 $ ./ex1-3.plx = item atan2 y, x
Returns the arctangent of y / x in the range --pi.
For the Tangent Operation, You May Use The Posix :: Tan () Function, or Use the family of deflation:
Sub Tan {sin ($ _ [0]) / COS ($ _ [0])} Seeing the difference ~~~, huh! Let's first understand it first. The first chapter is to let you feel these two examples, so it will not play. I will play in the future.