Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Date::Calc question

by Athanasius (Archbishop)
on Jul 17, 2015 at 08:40 UTC ( [id://1135124]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-03-29 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found