Using Perl


  1. Check the Perl Help Pages.

  2. Apply for a UND Engineering Linux Account.

  3. Log in to the Linux Server undcemcs02.und.edu .

  4. Create a Perl Script such as Example.pl:

  5. #!/usr/bin/perl
    # Perl program to illustrate iteration through an array
    
    # array creation
    @arr = ( 11, 22, 33, 44, 55 );
    
    # Iterating through the range
    print( "Iterating through range:\n" );
    
    # size of array
    $len = @arr;
    	
    for ( $b = 0; $b < $len; $b = $b + 1 ) {
      print "\@arr[$b] = $arr[$b]\n";
    }
    
    # Iterating through loops
    print( "\nIterating through loops:\n" );
    
    # foreach loop
    foreach $a ( @arr ) { print "$a "; }



  6. Interpret the Script.
  7. For example,
       undcemcs02> /usr/bin/perl  Example.pl    
    where the Perl interpreter is located at
       undcemcs02>     






      A penny saved is a penny earned.