How do you read the system time and date in Perl?

后端 未结 5 1415
太阳男子
太阳男子 2021-01-11 17:13

I need to read the system clock (time and date) and display it in a human-readable format in Perl.

Currently, I\'m using the following method (which I found here):

5条回答
  •  旧时难觅i
    2021-01-11 17:20

    Use localtime function:

    In scalar context, localtime() returns the ctime(3) value:

    $now_string = localtime;  # e.g., "Thu Oct 13 04:54:34 1994"
    

提交回复
热议问题