Hi David,

"require" doesn't allow you to use the function without parentheses: 
"use strict;" in your script would have thrown a "bareword not allowed" 
exception. The "import" call allows you to use gettimeofday() instead 
of the fully qualified version, but it doesn't serve as a function 
declaration. Run-time is too late for that.

The following works as you'd hope...

if($] > 5.006) {
     require Time::HiRes;
($seconds, $microseconds) =Time::HiRes::gettimeofday();
print "Seconds = $seconds    Microseconds = $microseconds\n\n";
   }
else{
print "Pleased to be old\n";
}

Under classic in MacPerl 5.6.1b2 I get:

Seconds = 3091144365    Microseconds = 184428

Cheers,
Paul

Reply via email to