在 perl 中使用 ctime 的正确方法是什么?

JB_*_*ser 3 perl

我有使用 ctime() 的旧 perl 代码。它需要“ctime.pl”。这不再适用于较新的 perl 版本。这就是我将如何使用它

my ($currDay, $currMon, $currDate, $currTime, $currYear) = split(" ", ctime(time));
Run Code Online (Sandbox Code Playgroud)

我怎样才能使这项工作?

yst*_*sth 6

你可以做:

use POSIX 'ctime';
Run Code Online (Sandbox Code Playgroud)