First, a single array element should be written like this:
$begindate_fields[2];
and not like this:
@begindate_fields[2];
The latter is an array slice. The warnings pragma would have told you this. You should always start your script with:
use strict;
use warnings;
This will save you a lot of time and trouble in the long run.
Second, Date::Manip::ParseDate interprets your dates as MM/DD/YYYY, not DD/MM/YYYY. So 1988-12-13 becomes the twelfth day of the thirteenth month of 1988 — which does not exist. You need to swap the first and second array indices:
my $normalized_begindate = $begindate_fields[1] . "/" . # Month
$begindate_fields[2] . "/" . # Day
$begindate_fields[0]; # Year
my $normalized_enddate = $enddate_fields [1] . "/" . # Month
$enddate_fields [2] . "/" . # Day
$enddate_fields [0]; # Year
Hope that helps,
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|