Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

II. Answers > P. Answers to Chapter 16 Exercises - Pg. 137

APPENDIX P Answers to Chapter 16 Exercises Answer 16.1: Set the environment variable TZ by replacing its value in the %ENV hash. The value you need to set varies from system to system and, at least on a Unix machine, you use the names of files in /usr/share/zoneinfo. For the Pacific time zone, some systems use PST8PDT . After that, use exec to turn your perl process into the date command, which has the same environment as the perl process. You've effectively created a wrapper that sets up the environment then executes the desired command: #!/usr/bin/perl use strict; use warnings; $ENV{TZ} = 'PST8PDT';