Help for this page

Select Code to Download


  1. or download this
    unless ( open(FILE, $filename) ) {
      print "Cannot open file \"$filename\"\n\n";
      exit;
    }
    
  2. or download this
    open my $FILE, '<', $filename 
      or die "Cannot open file '$filename': $!\n";
    
  3. or download this
    # Sum of all elements in array:
    $sum=0;
    $sum=eval join '+',@array;
    
  4. or download this
    # Sum of all elements in array:
    $sum=0;
    $sum+=$_ for @array;