user1613245
user1613245

Reputation: 351

now function for displaying Date and Time not working through ActivePerl

I want to display the present date and time in perl using now() function. I am running this script using Active Perl software but I am getting error.

#! /usr/bin/perl
use Date::Parse;
$date = str2time(now());
print "$date\n";

I am getting error as:

C:\Users\admin\Desktop>perl test.pl
Can't locate Date/Parse.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib
.) at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3.

Please help.

Upvotes: 1

Views: 785

Answers (1)

mvp
mvp

Reputation: 116387

You do not have module Date::Parse installed by default in ActivePerl.

You can fix this with:

ppm install Date::Parse

This works for me for ActivePerl 5.16 default install.

Upvotes: 6

Related Questions