jason corbett wrote:
i want to use the sub routine to time stamp processes and such whenever i need to. So, I wrote this below to call the routine into a variable $process_date. Is there a better way to read the date into a variable and use it?

For one you should scope it if its a function.

IE

use strict;
use warnings;

print "Dateme is: " . dateme() . "\n";


sun dateme { return "your value here"; }

The second thing is why not use time() or localtim() instead of calling the system dat function and worrying all about that mess, Just do


print "Dateme is: " . localtime() . "\n";


No artificial flavors, no artificial colors and none of these! :)


Thanks,

JC
sub dateme{
  $process_date=system('return date');


I think this is nnot doing what you expect either.

Use localtime(), time() (for easy epoch stamping) or if you really want control:

use POSIX;
POSIX::strftime()


perldoc POSIX perldoc -f time perldoc -f localtime


}return;

return outside the function? huh??

perldoc -f return


HTH

Lee.M - JupiterHost.Net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to