in reply to day of year

If you can use the date command to do it, you can always use it internally:
use POSIX 'strftime'; print strftime("%j", localtime(time()));
The strftime() function is able to process these percent-style variables. This may help with your remapping. Otherwise, you can always just add one.