--- Clinton <[EMAIL PROTECTED]> wrote:
> I have separated Year, Month and Day so I can feed into the Date_to_Text
> function from Calc.
>
> $firstdate = $dates[1];
> $firstdate =~m/(\d*)-0?(\d*)-0?(\d*)/g;
> my $year = $1;
> my $month = $2;
> my $day = $3;
>
> If I print $firstdate it correctly prints 2001-07-16 00:00:00
> However
> my $firstcalc = Date_to_Text($year,$month,$day);
> reports an error
> Date::Calc::Date_To_Text not a valid date.
I don't have enough code here to tell what's going on, but I noticed some things. The
/g modifier
is for substitutions, not matches. Also, if your regex fails to match and the dollar
digit ($1,
$2, $3) variables previously had values, you can be getting a false match.
$firstdate = $dates[1];
my ( $year, $month, $day ) = ( $firstdate =~m/^(\d+)-0?(\d+)-0?(\d{1,2})/ );
Since I haven't used the Date::Calc module, I can't offer more advice beyond that.
Cheers,
Curtis "Ovid" Poe
=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]