in reply to help with algorithm
for (1 .. 7) {push @days, $_ if ((2 ** $_) & $day_mask)} [download]
for (1 .. 7) {push @days, $_ if ((2 ** $_) & $day_mask)}
You didn't test it very well. You need 0..6 not 1..7.
-sauoq "My two cents aren't worth a dime.";