Anish Kumar K. wrote:
$filename = "data_logfile" .(localtime). ".txt";
open(LOG, ">>$filename") || die "cannot append: $!";

when I compile the file is says "Invalid argument". This is  because of the colon 
character.

Suppose after one activity I want to update the log activities in one file say
data_logfileTIME.txt

You could use the time() function which returns the number of seconds since the epoch (Jan 1 1970 on Unix systems.)


perldoc -f time


Or if you want a human readable format you could use the POSIX::strftime() function.


perldoc POSIX


Or you could extract the fields from localtime() or gmtime() in list context and use sprintf() to format them.


perldoc -f localtime
perldoc -f gmtime
perldoc -f sprintf



John
--
use Perl;
program
fulfillment

--
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