Help for this page

Select Code to Download


  1. or download this
    my %total_for;
    
  2. or download this
    my $operator = 'Nicole';
    $total_for{$operator} = 123;  # total for Nicole is 123
    $total_for{$operator} += 45;  # increase Nicole's total by 45.
    
  3. or download this
    foreach my $operator ( sort keys %total_for ) {
        print "Total for $operator: $total_for{$operator}\n";
    }
    
  4. or download this
    open(LOG, $file) or die "Can't read '$file': $!";
    
  5. or download this
    while (<LOG>) {
        @tmpwords = split;
        # etc.
    }
    
  6. or download this
    foreach my $blah ( @array ) {
        # use $blah instead of $_ for things
    }
    
  7. or download this
    use strict;
    use warnings;
    ...
    foreach my $operator ( sort keys %total_for ) {
        print "Total for '$operator': $total_for{$operator}\n";
    }