Index Pod redakcjš Charlesa E. Skinnera Psychologia wychowawcza (13) Kurcz Ida Pamięć, uczenie się, język (13) George Orwell Folwark zwierzęcy (13) rok 2026 10 13 Chmielewska Joanna Wielki diament T 2 (3) DROGA (2).TXT GAIMAN~1 (2) 0013 McCaffrey Anne Damia Gdzie jest twój dom, Ziemianinie (2) |
[ Pobierz całość w formacie PDF ] .The g option after the // operator means that we want to do this for the entire string, even after we find a match.The =~ operator means that we carry out this operation on a given string ( Yon Yonson, Wisconsin ).Finally, the whole thing is evaluated in an array context, so Perl returns the array of matches, and we store it in the @hits array.Following is the output from this example:Matched on Yon, Yon, son, con.SubstitutionWhen you get the hang of pattern matching, you'll find that substitutions are quite straightforward and very powerful.The substitution operator is s/// , which resembles the match operator but has three rather than two slashes.Just as you can do with the match operator, you can substitute any other character for the forward slashes, and you can use the optional i, g , and o switches.The pattern to be replaced goes between the first and second delimiters, and the replacement pattern goes between the second and third delimiters.This simple example changes $house from henhouse to doghouse :$house = "henhouse";$house =~ s/hen/dog/;Notice that it isn't possible to use the =~ operator with a literal string as you can when matching, because you can't modify a literal constant.Instead, store the string in a variable and modify that variable.From Here.You have reached the end of your whirlwind tour of Perl.You saw how Perl's deceptively simple constructs can be used to write deceptively simple programs, and you got a brief look at the basic elements of the language.At minimum, you should have a clear idea of how the language works, and you should know where to go for more information on Perl as the need arises throughout the rest of this book.This book now moves on to Web matters, but look in the following places for more information about Perl:Refer to Part V of this book for comprehensive information on Perl special variables, operators, and built-in functions.Also refer to Part V to learn how to use modules and libraries to compartmentalize your code for greater robustness and extensibility.Consider buying a book that deals in detail with the Perl language.The definitive work is the "Camel" book, cited at the beginning of this chapter [ Pobierz całość w formacie PDF ] |
||||
Wszelkie Prawa Zastrzeżone! Kawa była słaba i bez smaku. Nie miała treści, a jedynie formę. Design by SZABLONY.maniak.pl. | |||||