Changeset 22301 for docs

Show
Ignore:
Timestamp:
09/20/08 22:53:26 (4 months ago)
Author:
Whiteknight
Message:

[Book] A few small changes for readability and flow. Remove some trailing whitespace

Location:
docs/tutorial
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • docs/tutorial/ch01_overview.pod

    r16690 r22301  
    8585the job. A linguist at heart, Larry set out to create his own 
    8686programming language, which he called I<perl>. He released the first 
    87 version of Perl on December 18, 1987. He made it freely available on 
    88 Usenet (this was before the Internet took over the world, remember), 
    89 and quickly a community of Perl programmers grew. 
     87version of Perl on December 18, 1987 and made it freely available on 
     88Usenet (this was before the Internet took over the world, remember). 
     89Before long, a small community of Perl programmers grew up around it. 
    9090 
    9191The early adopters of Perl were system administrators who had hit the 
  • docs/tutorial/ch04_basic_syntax.pod

    r17701 r22301  
    8888 
    8989  @crew = "Zaphod", "Ford", "Trillian"; 
    90    
     90 
    9191  $second_member = @crew[1]; # Ford 
    9292 
     
    142142 
    143143As with arrays, assignment to a hash parses everything after the C<=> 
    144 as a list, so parentheses are not needed around the list. 
     144as a list, so parentheses are not needed around the list N<Although 
     145you can have them too, if you prefer>. 
    145146 
    146147The key for each value may be a string or an object, though there are 
  • docs/tutorial/ch05_subroutines.pod

    r16696 r22301  
    88 
    99X<subroutines> 
    10 Subroutines are reusable units of code. They can be called from just 
    11 about anywhere, and return control to the point of the call when they 
    12 finish executing. They can be passed zero or more argumentsN<Following 
    13 the example set in Apocalypse 6, throughout this chapter we'll use the 
    14 term "argument" for the values passed into a subroutine call and 
    15 "parameter" for the lexical variables declared in the subroutine's 
    16 signature.> and return zero or more results. Subroutines can be named 
    17 or anonymous. They can be lexically scoped, package scoped, or 
    18 globally scoped. "Multi" subs allow multiple subroutines to have the 
    19 same name as long as they have different parameter lists. 
    20  
    21 Methods have a few significant differences from subroutines. In Perl 6 
    22 they're even distinguished by a separate keyword, C<method>. Because 
    23 of these differences, they'll be discussed in A<CHP-6>Chapter 6. 
     10Subroutines are reusable units of code, and one of the fundamental 
     11building blocks of modern programming languages. They can be called 
     12from just about anywhere, and return control to the point of the call 
     13when they finish executing. They can be passed zero or more 
     14argumentsN<Throughout this chapter we'll use the term "argument" for 
     15the values passed into a subroutine call and "parameter" for the 
     16lexical variables declared in the subroutine's signature.> and return 
     17zero or more results. Some programmers may be more familar with 
     18languages which only allow a single return value from a subroutine, 
     19or languages for which subroutines have exactly zero return values and 
     20"functions" may have one. Perl 6 generalized the concept to allow 
     21subroutines to return as many, or as few, return values as needed. We 
     22think it just makes more sense to let the programmer do what they want 
     23to do in this regard. 
     24 
     25Subroutines can be named or anonymous. They can be lexically scoped, 
     26package scoped, or globally scoped. Subroutines can be "Multi" subs, 
     27which allow multiple subroutines to have the same name as long as 
     28they have different parameter lists. 
     29 
     30Blocks of reusable code can also be called the "methods" of a particular 
     31class of object. Methods have a few significant differences from 
     32subroutines, a few significant differences from those found in Perl 5. 
     33For instance, in Perl 6 they're distinguished by a separate keyword, 
     34C<method>. Because of these differences, they'll be discussed in 
     35A<CHP-6>Chapter 6. 
    2436 
    2537=head1 Using Subroutines 
     
    3749 
    3850The simplest subroutine call is just the subroutine name followed by a 
    39 comma-separated list of variables or values:  
     51comma-separated list of variables or values: 
    4052 
    4153  $result = sum($a, $b, 42, 57); 
     
    4860predeclared, but required for all other calls. Including the C<&> 
    4961sigil before the subroutine name in a call will not turn off signature 
    50 checking. In fact, in most contexts prefixing the subroutine name with 
    51 C<&> will return a reference to the subroutine instead of calling the 
    52 subroutine. 
     62checking as it did in Perl 5. In fact, in most contexts prefixing 
     63the subroutine name with C<&> will return a reference to the 
     64subroutine instead of actually calling the subroutine. 
    5365 
    5466=head1 Parameters 
     
    5668Z<CHP-5-SECT-2> 
    5769 
    58 X<parameters;formal>  
     70X<parameters;formal> 
    5971X<formal parameters> 
    6072X<subroutines;signatures> 
    61 X<subroutines;parameters>  
     73X<subroutines;parameters> 
    6274One of the most significant additions to subroutines in Perl 6 is 
    6375named formal parameters. The parameter list, often called the 
     
    108120      ... 
    109121  } 
    110    
     122 
    111123  whole(@array, %hash); 
    112124