Need module to accept the timestamp from command line
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;
精彩评论