Thank you for your fast replies.
Unfortunately I can't use modules (because the person who this is for is a paranoid .... who is scared of the evilness that might be lurking in a module some "hacker" made -- not joking).
Because of this, I can't use the Time::HiRes module. I'm trying to display the load times of my scripts (in less than seconds). My sub for this is:
sub getTimeOfDay {
syscall(116,$tod,0);
my($s,$ms) = unpack("LL",$tod);
return $s + $ms / 1000000;
}
$tod = "\0\0\0\0\0\0\0\0";
...and basically I just get the start time and end time and compare them.
I want to add it to my subs file so I don't have to add that code to every script. The problem is that it won't work (script crashes/error 500/whatever you want to call it) unless $tod is defined in the script itself. The error log contains no information too.
I tried "do" and it didn't work. I also tried defining $tod in BEGIN and that did work,
but the script would crash about 4 out of every 5 times (which I find just weird).
I've been going crazy reading pages and pages of Perl help on the internet, and I've gotten nowhere, finally decided to ask and that's what I'm doing.