Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

(zdog) Re: Weird Date::Calc behavior; Bug?

by zdog (Priest)
on Apr 19, 2001 at 08:51 UTC ( [id://73759]=note: print w/replies, xml ) Need Help??


in reply to Weird Date::Calc behavior; Bug?

You cannot assign a scalar to an array that way. You should instead split the scalar up like so:

#!/usr/bin/perl -w #find-missing-files.pl use strict; use Date::Calc qw ( Delta_Days Add_Delta_Days ); my (@start, @stop); @start = split (/-/, $ARGV[0]); print "@start\n"; @stop = split (/-/, $ARGV[1]); print "@stop\n"; for ( my $i = 0; $i <= Delta_Days(@start, @stop); $i++ ) { my @date = Add_Delta_Days (@start, $i); printf ("%4d-%02d-%02d\n", @date); }
Update: You can also do something like:

$from =~ s/-/,/g; $to =~ s/-/,/g; @start = eval ($from); @stop = eval ($to);

Zenon Zabinski | zdog | zdog7@hotmail.com

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found