Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run a Perl script, but make it think that it is in a different timezone (GMT) than the server is configured to use normally.

I would like to do this without modify the existing script, by means of some environment variables or any configuration settings if possible.

This is for OS X and its vendor Perl (v5.12.4).

share|improve this question
up vote 6 down vote accepted

You can use the TZ environment variable ($ENV{TZ}). See for more details

share|improve this answer
The code for GMT would be TZ=GMT perl – Thilo Mar 12 '13 at 3:10
Pretty much. You can try it out yourself with print(scalar localtime); – vicfn Mar 12 '13 at 3:24
This was the right answer, but the community tends to frown on brief link based answers. The answer here is simple to explain, but usually it's not asking much to provide an inline example. I'm giving you the +1 anyway. – Andrew B Mar 12 '13 at 3:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.