Changes

Jump to navigation Jump to search
936 bytes added ,  01:34, 30 December 2013
Line 1: Line 1:  
== NAME ==
 
== NAME ==
   −
perlintro -- a brief introduction and overview of Perl
+
perlintro -- a brief introduction and overview of Perl,if you are looking to found the complete edition of perl documentation, see http://perldoc.perl.org/index.html
    
you can find the source of this Tutorial http://perldoc.perl.org/perlintro.html
 
you can find the source of this Tutorial http://perldoc.perl.org/perlintro.html
 +
 
== DESCRIPTION ==
 
== DESCRIPTION ==
   Line 173: Line 174:     
         $fruit_color{"apple"}; # gives "red"
 
         $fruit_color{"apple"}; # gives "red"
You can get at lists of keys and values with '''keys()''' and '''values()'''.
+
You can get at lists of keys and values with '''[http://perldoc.perl.org/functions/keys.html keys()]''' and '''[http://perldoc.perl.org/functions/values.html values()]'''.
    
         my @fruits = keys %fruit_colors;
 
         my @fruits = keys %fruit_colors;
Line 238: Line 239:  
==== if ====
 
==== if ====
   −
         if ( condition ) {
+
         [http://perldoc.perl.org/functions/if.html if] ( condition ) {
 
         ...
 
         ...
         } elsif ( other condition ) {
+
         } [http://perldoc.perl.org/functions/elsif.html elsif] ( other condition ) {
 
         ...
 
         ...
         } else {
+
         } [http://perldoc.perl.org/functions/else.html else] {
 
         ...
 
         ...
 
         }
 
         }
Line 248: Line 249:  
There's also a negated version of it:
 
There's also a negated version of it:
   −
         unless ( condition ) {
+
         [http://perldoc.perl.org/functions/unless.html unless] ( condition ) {
 
         ...
 
         ...
 
         }
 
         }
Line 266: Line 267:  
==== while ====
 
==== while ====
   −
         while ( condition ) {
+
         [http://perldoc.perl.org/functions/while.html while] ( condition ) {
 
         ...
 
         ...
 
         }
 
         }
Line 272: Line 273:  
There's also a negated version, for the same reason we have '''unless''' :
 
There's also a negated version, for the same reason we have '''unless''' :
   −
         until ( condition ) {
+
         [http://perldoc.perl.org/functions/until.html until] ( condition ) {
 
         ...
 
         ...
 
         }
 
         }
Line 284: Line 285:  
Exactly like C:
 
Exactly like C:
   −
         for ($i = 0; $i <= $max; $i++) {
+
         [http://perldoc.perl.org/functions/for.html for] ($i = 0; $i <= $max; $i++) {
 
         ...
 
         ...
 
         }
 
         }
   −
    The C style for loop is rarely needed in Perl since Perl provides the more friendly list scanning '''foreach''' loop.
+
The C style for loop is rarely needed in Perl since Perl provides the more friendly list scanning '''foreach''' loop.
 +
 
 
==== foreach ====
 
==== foreach ====
   −
         foreach (@array) {
+
         [http://perldoc.perl.org/functions/foreach.html foreach] (@array) {
 
         print "This element is $_\n";
 
         print "This element is $_\n";
 
         }
 
         }
Line 300: Line 302:  
         }
 
         }
   −
    The '''foreach''' keyword is actually a synonym for the for keyword. See [http://perldoc.perl.org/perlsyn.html#Foreach-Loops Foreach Loops in perlsyn].
+
The '''foreach''' keyword is actually a synonym for the for keyword. See [http://perldoc.perl.org/perlsyn.html#Foreach-Loops Foreach Loops in perlsyn].
    
For more detail on looping constructs (and some that weren't mentioned in this overview) see [http://perldoc.perl.org/perlsyn.html perlsyn].
 
For more detail on looping constructs (and some that weren't mentioned in this overview) see [http://perldoc.perl.org/perlsyn.html perlsyn].
Line 306: Line 308:  
=== Builtin operators and functions ===
 
=== Builtin operators and functions ===
   −
Perl comes with a wide selection of builtin functions. Some of the ones we've already seen include '''print''', '''sort''' and '''reverse'''. A list of them is given at the start of perlfunc and you can easily read about any given function by using '''perldoc -f functionname'''.
+
Perl comes with a wide selection of builtin functions. Some of the ones we've already seen include '''[http://perldoc.perl.org/functions/print.html print]''', '''[http://perldoc.perl.org/functions/sort.html sort]''' and '''[http://perldoc.perl.org/functions/reverse.html reverse]'''. A list of them is given at the start of [http://perldoc.perl.org/perlfunc.html perlfunc] and you can easily read about any given function by using '''perldoc -f functionname'''.
   −
Perl operators are documented in full in perlop, but here are a few of the most common ones:
+
Perl operators are documented in full in [http://perldoc.perl.org/perlop.html perlop], but here are a few of the most common ones:
    
==== Arithmetic ====
 
==== Arithmetic ====
Line 404: Line 406:  
         # in $a
 
         # in $a
   −
The '''s///''' substitution operator is documented in [http://perldoc.perl.org/perlop.html perlop].
+
The '''[http://perldoc.perl.org/functions/s.html s///]''' substitution operator is documented in [http://perldoc.perl.org/perlop.html perlop].
 +
 
 
==== More complex regular expressions ====
 
==== More complex regular expressions ====
   Line 521: Line 524:     
Kirrily "Skud" Robert <skud@cpan.org>
 
Kirrily "Skud" Robert <skud@cpan.org>
 +
[[Category:Developer]]
 +
[[Category:SME Server Development Framework]]
 +
[[Category:Development Tools]]

Navigation menu