开发者

Need module to accept the timestamp from command line

开发者 https://www.devze.com 2023-03-24 00:38 出处:网络
I need a module to accept the following timestamp from command line in Perl. 2010/11/29 09:39:57 I have used the Getopt::Long module to accept the command line option开发者_运维知识库s. But it doe

I need a module to accept the following timestamp from command line in Perl.

        2010/11/29 09:39:57

I have used the Getopt::Long module to accept the command line option开发者_运维知识库s. But it doesn't accept the full timestamp from command line. It is accepting only date value(2010/11/29) not accepting the time value(09:39:57).

If anyone know the module to solve this issue, kindly let me know.

Thanks in advance.


Just put quotes around the timestamp. It should work fine with Getopt::Long

./script.pl -t '2010/11/29 09:39:57'


If you want them to be separate arguments, you could do something like this:

GetOptions('date=s{2}' => \@date);
my ($day, $time) = @date;
0

精彩评论

暂无评论...
验证码 换一张
取 消