Skip navigation.
Your source for Perl tips, howto's, faq and tutorials
( categories: )

Hi All,

I am new to this perl.Please help my doubts.
Currently i have created a file using perl, and in this created file is displayed with current date and time.
But i want to add more in this file,that is based on the time interval, the date and time should be displayed in the file.

e.g: If i enter the time interval as "3", then every 3 mins once the the time should be updated in the file.

This is my requirement.Can anybody send me the reply with sample code?

Please help me anybody.Expect your replies as soon as possible.

Thanks in advance,

You can do this by using alarms in perl

Try the below code, change the time in the "alarm()" as your requirement.

while (1){

sub some_sub {
eval {
local $SIG{ALRM} = sub {system("date > date.file"); die " SIG ALRM";};


my $i=0;

$i++ while 1;