At 02:47 PM 8/11/2003 -0500, you wrote:
>Thanks John,
>
>I'm going to use this for getcurrenttime:
>$CurrentTime = exec 'date | awk \'{print $4}\'';
>
>It should work ok for what i need it for.
>If I do see it eats up my cpu, then i will move that part of the code
>out into its own file and run it from a cron. But hopefully it works
>justs fine running with the bot. :p
Try to avoid using the exec() family, including backticks, if possible. If
you are forced to use it then be sure to use absolute paths. Anyway, here
is how to get the current date and time:
#!/bin/perl -w
my ($sec, $min, $hour, $day, $month, $year) = (localtime(time()))[0 .. 5];
$year_y2k = $year + 1900;
print "$hour:$min:$sec\n";
print "$month-$day-$year_y2k\n";
Running it gives us:
$ perl getdate.pl
16:42:41
7-11-2003
---
Dustin Puryear <[EMAIL PROTECTED]>
Puryear Information Technology, LLC <http://www.puryear-it.com>
Providing expertise in the management, integration, and
security of Windows and UNIX systems, networks, and applications.