Thanks for any guidance :)
The easiest way would be to create a variable with the datetime in it,
and have that printed.
my $dt = localtime();
print <<EOF;
Generated: $dt
I'm playing with a perl script that generates a report of held packets for 1/100 HUB. I want to add a printed header that includes the date and time the snapshot was generated. Can anyone advise the best syntax and code to use?
Currently the script starts of printing a header that looks like this
print <<EOF; +------------------+--------+-----------+-----------+-----------+
| Node | Days | NetMail | EchoMail | Files | +------------------+--------+-----------+-----------+-----------+
EOF
I want to add the date/time prior to it.
Though not answering your question, why aren't you using the formats abilities of PERL to display your headers?
https://www.tutorialspoint.com/perl/perl_format.htm
This makes it extremely easy to add and change headers and details, while dealing with the formatting for you. If you've never used it, it's really worth learning. It can save you a lot of time in the end once you understand it.
Sysop: | echicken |
---|---|
Location: | Toronto, Ontario |
Users: | 2,224 |
Nodes: | 6 (0 / 6) |
Uptime: | 14:52:37 |
Calls: | 14,143 |
Files: | 295 |
Messages: | 551,310 |