Help for this page

Select Code to Download


  1. or download this
    # Vacations: day 7 to 14, 20, 22, 25 to 30
    #
    ...
    # list entries          X       X    XXXX X    X
    
    my @vacation_skip = 7, 15, 20, 21, 22, 23, 25, 31
    
  2. or download this
    use List::MoreUtils qw/last_index/;
    my @vacation_skip = (7, 15, 20, 21, 22, 23, 25, 31);
    ...
    } else {
        print "work day\n";
    }
    
  3. or download this
    sub range_overlaps {
        my ($start_probe, $end_probe, @skip) = @_;
    ...
        my $end_idx   = last_index { $_ <= $end_probe   } @skip;
        return $start_idx != $end_idx || ($start_idx % 2 == 0);
    }
    
  4. or download this
    my @proxy_vacations = (0, @vacation_skip);
    
  5. or download this
    sub inverted {
        if ($_[0] == 0) {
    ...
            return (0, @_);
        }
    }
    
  6. or download this
    #                 0        1         2         3         4
    # day no.         0123457890123456789012345678901234567890
    ...
    # new range                         #######
    # new vacations         ########    ###########
    # new markers           X       X   X          X
    
  7. or download this
    my @items   = qw/a  b  c  d  e/;
    my @weights = (0.1, 2, 1, 4, 1.3);
    ...
    }
    use Data::Dumper;
    print Dumper \@summed_weights;