in reply to help with algorithm

Your variable name, $days_mask, gives a clue. You are working with a bitmask. As Zaxo pointed out, you need to use a bitwise-and to extract the value of individual bits. If you just want the day numbers you might do it like this:

my @day_numbers = grep $days_mask[$i] & 2**$_, 0..6;
-sauoq
"My two cents aren't worth a dime.";