@uptimeday=split(/./,$uptimeday);
Do you mean /\./ (a period) instead of /./ (any character except a newline)?
if($uptimeday gt "0") {
If $uptimeday is a number, then you should use "if($uptimeday>0){".
print "... day\(s\) ...
You don't need to escape that, "day(s)" is fine. Same for hour and minute.
You're also missing three curly brackets at the end, but I'll assume you just didn't copy them and they are actually there.
Also, while there isn't anything wrong with:
@uptimeday = split(/\./, $uptimeday);
$uptimeday = $uptimeday[0]; #give it a nicer name !
It is a bit much for such a simple task. It would be easier to use:
$uptimeday=~s/\..*//;
Or just cast it as an integer:
$uptimeday=int($uptimeday);
Unless you're going to use the decimal you truncate off later in the program, I wouldn't waste the memory storing it.




Bookmarks