Changes

Jump to navigation Jump to search
90 bytes added ,  17:15, 28 December 2013
Line 305: Line 305:  
=== 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 '''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 operators are documented in full in perlop, but here are a few of the most common ones:
 
Perl operators are documented in full in perlop, but here are a few of the most common ones:
Line 334: Line 334:  
         ge greater than or equal
 
         ge greater than or equal
   −
    (Why do we have separate numeric and string comparisons? Because we don't have special variable types, and Perl needs to know whether to sort numerically (where 99 is less than 100) or alphabetically (where 100 comes before 99).
+
(Why do we have separate numeric and string comparisons? Because we don't have special variable types, and Perl needs to know whether to sort numerically (where 99 is less than 100) or alphabetically (where 100 comes before 99).
    Boolean logic
+
==== Boolean logic ====
    
         && and
 
         && and
Line 341: Line 341:  
         ! not
 
         ! not
   −
    (and , or and not aren't just in the above table as descriptions of the operators. They're also supported as operators in their own right. They're more readable than the C-style operators, but have different precedence to && and friends. Check perlop for more detail.)
+
('''and''' , '''or''' and '''not''' aren't just in the above table as descriptions of the operators. They're also supported as operators in their own right. They're more readable than the C-style operators, but have different precedence to '''&&''' and friends. Check [http://perldoc.perl.org/perlop.html perlop] for more detail.)
 
==== Miscellaneous ====
 
==== Miscellaneous ====
   Line 349: Line 349:  
         .. range operator (creates a list of numbers)
 
         .. range operator (creates a list of numbers)
   −
Many operators can be combined with a = as follows:
+
Many operators can be combined with a '''=''' as follows:
    
     $a += 1; # same as $a = $a + 1
 
     $a += 1; # same as $a = $a + 1

Navigation menu