----- Original Message -----
From: WC -Sx- Jones
Sent: 21.04.2004, 14:23 Uhr

>Jan Eden wrote:
>
>> if (season($start_date) && season($end_date) {
>>     $season_days = Delta_Days($start_date, $end_date)
>> } elsif season($start_date) {
>
>
>try not to make it *more* complicated :)
>
>You posted your own answer in the first post.
>
>Consider:
>
>((season($start_date) && (season($end_date)) ?
>   go sub for $80 : or go sub for $55;
>
>Or however you want to test for Summer.

I'm afraid it's not that simple. Consider a start date of June 13 and an end date of 
June 20. In that case, season($start_date) will return false, making the whole test 
expression false. But only the first three days will cost $55 in that case. So the 
calculation should be:

$other_days = Delta_Days($start_day, $div_day);
$season_days = Delta_Days($div_day, $end_day);

And I have exactly three other situations:

$season_days = Delta_Days($start_day, $end_day);
---
$other_days = Delta_Days($start_day, $end_day);
---
$season_days = Delta_Days($start_day, $div_day2);
$other_days = Delta_Days($div_day2, $end_day);

To capture the four possible configurations correctly, the condition given above is 
not sufficient.

Thanks,

Jan
-- 
There are 10 kinds of people:  those who understand binary, and those who don't

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to