in reply to Generate list with array elements repeated x times
sub date_list { my ( $from, $to ) = @_; my @dates = $from; my $intermediate = $from; while ( $intermediate ne $to ) { $intermediate = sprintf "%04d-%02d-%02d", Add_Delta_Days( spli +t( /-/, $intermediate ), 1 ); push @dates, $intermediate; } my $first = shift(@dates); my $last = pop(@dates); return map { ($_) x 10 } @dates; }
Outputs for me using 2014-01-02 and 2014-01-06:
2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-03 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-04 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05 2014-01-05
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Generate list with array elements repeated x times
by Anonymous Monk on Oct 16, 2014 at 20:55 UTC | |
by toolic (Bishop) on Oct 16, 2014 at 20:59 UTC |