Hi guys,
I got couple of questions about this code:
questions :
1. what's different between "my $datestamp" and "$datestamp", I've tried both and it's working fine?
any explanation?
2. what's $DATABASE for? I've tried without it and still working? is there in library somewhere?
3. if I remove the # behind the printf, those code won't work, any idea why?
the error as below :
syntax error at ./test.pl line 10, near "$mday
print"
Execution of ./test.pl aborted due to compilation errors.
Thanks guys for your explanation,
Appreciate that!
I got couple of questions about this code:
Code:
### Need timestamp to find the files
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time() - 24*60*60);
[b]my $datestamp[/b] = sprintf("%04d%02d%02d",$year+1900,$mon+1,$mday);
$output_prefix = $datestamp.[b]$DATABASE[/b];
[b]#[/b]printf "testing %04d%02d%02d\n",$year,$mon,$mday
print "output timestamp $output_prefix"
questions :
1. what's different between "my $datestamp" and "$datestamp", I've tried both and it's working fine?
any explanation?
2. what's $DATABASE for? I've tried without it and still working? is there in library somewhere?
3. if I remove the # behind the printf, those code won't work, any idea why?
the error as below :
syntax error at ./test.pl line 10, near "$mday
print"
Execution of ./test.pl aborted due to compilation errors.
Thanks guys for your explanation,
Appreciate that!