Chúng tôi bắt đầu chương này bằng cách khai thác các cấu trúc cơ bản của Perl. Chúng tôi bao gồm báo cáo, tờ khai, biểu hiện, và các khối. Chúng tôi nhìn cụ thể tại các cơ sở cung cấp bởi các khối. Chúng tôi bao gồm báo cáo có điều kiện Perl, nếu khác, elsif, và trừ khi. Chúng tôi cũng nhìn vào chi tiết làm thế nào | Structure Flow and Control Simpo PDF Merge and Split Unregistered Version - http Summary We started this chapter by exploring the basic structures of Perl. We covered statements declarations expression and blocks. We looked in particular at the facilities provided by blocks. We covered Perl s conditional statements if else elsif and unless. We also looked in detail at how to create loops with for and foreach and how to create conditional loops with while until do and . The chapter also covered how to control the execution of loops with the modifiers next last redo and continue. Finally the chapter covered the goto statement as well as map and grep. Team-Fly 213 Chapter 6 Simpo PDF Merge and Split Unregistered Version - http 214 Simpo PDF Merge and Split Unregistered Version - http 7 Subroutines Subroutines are autonomous blocks of code that function like miniature programs and can be executed from anywhere within a program. Because they are autonomous calling them more than once will also reuse them. There are two types of subroutine named and anonymous. Most subroutines are of the named persuasion. Anonymous subroutines do not have a name by which they can be called but are stored and accessed through a code reference. Since a code reference is a scalar value it can be passed as a parameter to other subroutines. The use of subroutines is syntactically the same as the use of Perl s own built-in functions. We can use them in a traditional function-oriented syntax with parentheses or treat them as named list operators. Indeed we can override and replace the built-in functions with our own definitions provided as subroutines through the use of the use subs pragma. Subroutines differ from ordinary bare blocks in that they can be passed a list of parameters to process. This list appears inside subroutines as the special variable @_ from which the list of passed parameters also known as arguments can be