At 22:18 -0500 2001.12.11, Greenblatt & Seay wrote:
>I am trying to write a program that uses a timer and works with MacPerl
>5.6.1 as well as 5.004. For 5.6.1 I would like to take advantage of
>microseconds.
>
>When I use the following line in 5.004...
>
>  if($] > 5.006) { use Time::HiRes qw(gettimeofday) }
>
>it results in the error message "# Can't locate Time/HiRes.pm in @INC."

Right.  use() is compile-time, and your if() is run-time.


>Is there a way around that?

Yes.  If you have The Perl Cookbook, there are several examples.  Some
quick ones off the top of my head:

a. require/import
        require Time::HiRes;
        Time::HiRes->import('gettimeofday');

b. eval
        eval "use Time::HiRes 'gettimeofday'";

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to