PERL

This is intended as a personal on-line resource of perl code that I've found usefull. As time goes on, and I get more experience, I'll add more to this page. More extensive on-line crib-sheets can be found at TODO. Personally I tend to prefer to have references examples of actual code.

The keyword BLOCK refers to a generic block of perl code.

    /^/#/

    Flow control

    conditional

    
    if ( $a != $b ) { BLOCK }
       elsif($b = 3) { BLOCK }
       else { BLOCK }
    
    unless ( $a >= $b && $a < 0) { BLOCK }
    

    looping

    
    LOOPLABEL: while ( $a != $b ) {
    if ( $c = 0 ) { last LOOPLABEL} # exits the loop
       if ( $d = 2 ) { next LOOPLABEL} # jumps to next itteration of the loop
       $c--;
       }
    for ($a=0; $a++; $a>10) {BLOCK
    	}
    

    CONDITIONAL

    Numeric

    String

    pattern matching

    pattern count suffix

    concatinalting conditionals

    evaluated left to right.

    Strings

    operators

    Lists

    Hashes

  1. GVIM maps

    prototypes