http://www.perlmonks.org?node_id=637560


in reply to Re: ENV{TZ} and localtime? (inconsistent time in child script)
in thread ENV{TZ} and localtime? (inconsistent time in child script)

Thanks, I think I found an solution in the docs you referenced for _tzset:
Use the following syntax to set the TZ environment variable: set TZ=tzn[+ | ]hh[:mm[:ss] ][dzn] tzn Three-letter time-zone name, such as PST. You must specify the correct + offset from local time to UTC.
So I tried "EST5EDT" instead of -0400, and that gives the right result. I'm still not sure why it behaves differently when called via system() though.

update:used code tags so brackets in syntax aren't hidden.