melsterTEK
Programmer
Hi I need help in writing this perl code for matching a string with today's date.
I have the following code that gives me date:
#!/usr/bin/perl
($sec,$min,$hour,$mday,$mon,$year,$wday,
$yday,$isdst)=localtime(time);
printf "%4d-%02d-%02d\n",
$year+1900,$mon+1,$mday;
Result => 2007-02-20
I want to take this and add this to my pattern match which I have so far..
$sth->execute;
# fetch rows
while (($errorlog,
$continuationrow
)= $sth->fetchrow_array( )) {
if ($errorlog =~ /Operating system/) {
$data = $data."$_ Errors found:$errorlog\n";
}
}
What I want to do is get the errors found in $errorlog where date is todays date in this format (2007-02-20).
Thanks!
I have the following code that gives me date:
#!/usr/bin/perl
($sec,$min,$hour,$mday,$mon,$year,$wday,
$yday,$isdst)=localtime(time);
printf "%4d-%02d-%02d\n",
$year+1900,$mon+1,$mday;
Result => 2007-02-20
I want to take this and add this to my pattern match which I have so far..
$sth->execute;
# fetch rows
while (($errorlog,
$continuationrow
)= $sth->fetchrow_array( )) {
if ($errorlog =~ /Operating system/) {
$data = $data."$_ Errors found:$errorlog\n";
}
}
What I want to do is get the errors found in $errorlog where date is todays date in this format (2007-02-20).
Thanks!