in reply to Get DoB Bounds from Age Range
If it works then it works. :) But since you asked, i would rename the variables and try to clean up how you handle default values. For example:
use DateTime; # ... sub DoBrangefromAges { my $min = shift || 0; my $max = shift || 0; my $inclusive = $_[0] ? 1 : 0; my ($xs,$ns) = (DateTime->now, DateTime->now); $xs->subtract(years => $min, days => -$inclusive); $ns->subtract(years => $max, days => 364 + $inclusive); return $xs->ymd('-'), $ns->ymd('-'); }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Get DoB Bounds from Age Range
by over2sd (Beadle) on May 07, 2015 at 17:22 UTC | |
by wrog (Friar) on May 07, 2015 at 17:57 UTC | |
by over2sd (Beadle) on May 08, 2015 at 01:39 UTC | |
by jeffa (Bishop) on May 07, 2015 at 17:38 UTC | |
by over2sd (Beadle) on May 07, 2015 at 21:40 UTC |