My first thought would be to use Time::Local to convert the localtime
results back to epoch, with the appropriate values forced to 0 or 1 as needed. Note that day of week is not among the input values it expects, so you don't need to worry about what happens if you get that wrong.
$start_of_month_epoch = timelocal(0, 0, 0, 1, $month, $year);