While working on a solution for Does a file really exist?, I came across some bizarre behavior, that's got me tearing my hair out. Basically, the code below is taken directly from perldoc Date::Calc.
#!/usr/bin/perl -w #find-missing-files.pl use strict; use Date::Calc qw( Delta_Days Add_Delta_Days ); my (@start, @stop); my $from = $ARGV[0]; my $to = $ARGV[1]; $from =~ s/-/,/g; $to =~ s/-/,/g; #@start = $from; print "@start\n"; #@stop = $to; print "@stop\n"; @start = (1999,05,27); @stop = (1999,06,01); my $j = Delta_Days(@start,@stop); for ( my $i = 0; $i <= $j; $i++ ) { my @date = Add_Delta_Days(@start,$i); printf("%4d-%02d-%02d\n", @date); }
As is,
./find-missing-files.pl
will produce the following output:
1999-05-27 1999-05-28 1999-05-29 1999-05-30 1999-05-31 1999-06-01
But, uncomment:
#@start = $from; print "@start\n"; #@stop = $to; print "@stop\n";
comment this:
@start = (1999,05,27); @stop = (1999,06,01);
and run:
./find-missing-files.pl 1999-05-27 1999-06-01
it returns:
1999,05,27 1999,06,01 Usage: Date::Calc::Delta_Days(year1, month1, day1, year2, month2, day2 +) at ./test.pl line 19.
Can anyone explain what's going on here?

In reply to Weird Date::Calc behavior; Bug? by Tuna

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.