The aim is to work out N 'business days' from now.

Every one defines business days differently, but for me it's Monday to Friday skipping public holidays.

Step 1: Set of every day
Step 2: Complemented with weekends
Step 3: Complemented with public holidays

However, the code I've put together dies in rather nasty ways or runs really slowly (change the @events in the grep to @events[1,2])

If we forget about holidays, then it's nice and fast (though I'd prefer not to have to interate ...)

I'm guessing the speed decrease is due to the recurrence getting random holes (the public holidays) means we need to enumerate the entire set.

But for now, if someone could take a look at the code and see if you can work out why it dies, it would be much appreciated.

(note that $events[6] is the 28th of January and so it should be skipped .. but if you include '6' in the @events slice, you end up with it dieing on day 9)

Cheers!
Rick Measham

Attachment: business_days.pl
Description: Perl program

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to