in reply to Print every past three months from current month
Why not take a slice instead of using splice.
my @a = qw( a b c d e f g ); sub f { my $i = shift; print join(',', @a[$i-2, $i-1, $i]), "\n"; } f(0); f(1); f(2); f(6);
outputs
f,g,a g,a,b a,b,c e,f,g
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print every past three months from current month
by Anonymous Monk on Apr 01, 2014 at 13:00 UTC | |
by wazat (Monk) on Apr 01, 2014 at 16:11 UTC | |
by AnomalousMonk (Archbishop) on Apr 01, 2014 at 18:48 UTC |