Can't modify constant item in scalar assignment at calendar.pl line 276, near ""$year.$month.$day";"
This error is caused because you've forgotten the glyph to main::date
-- it should be $main::date
. Without the dollar sign, it's not considered a variable.
You should be wary of using a global variable for a return value, too. Are you really sure you want to change $main::date every time you want convert to epoch time? This sort of side effect, as well as the logic behind omitting a local declaration, should be documented to whatever standards you have.