in reply to Date::Calc question

Hello flynn7312,

any hints?

Yes: Tip #4 from the Basic debugging checklist:

Dump arrays, hashes and arbitrarily complex data structures.

But I actually prefer to use Data::Dump:

18:25 >perl 1309_SoPW.pl 2015,02,01 2015,06,05 ["2015,02,01"] ["2015,06,05"] Date::Calc::PP::Delta_Days(): Usage: Date::Calc::Delta_Days($year1,$mo +nth1,$day1,$year2,$month2,$day2) at 1309_SoPW.pl line 33 18:27 >perl 1309_SoPW.pl

The output from print "@c\n"; looks like a list of 3 elements, but the corresponding output from Data::Dump shows that it’s actually a single element, the string "2015,02,01".

As FreeBeerReekingMonk says, the problem is the call to join which turns the list into a string. Just remove the join, and the script works as expected.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Date::Calc question
by flynn7312 (Acolyte) on Jul 17, 2015 at 09:04 UTC
    thank you very much, it worked.
    ./date_test.pl 2015 02 01 2015 06 05 Difference is 124