Hi,
I came across some unexpected behaviour in datetime. In the following
script, I first define $date1. Then I set $day1 = $date1. Then I add 2 days
to $day1. Why does $date1 also get incremented?
#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
my $date1 = DateTime->new(year => 2007,
month => 12,
day => 23);
my $day1 = $date1;
$day1->add(days => 2);
print "day1 = ",$day1,"\n"; # gives me 2007-12-25 correctly.
print "date1 = ",$date1,"\n"; # why does $date1 also change to 2007-12-25?
Jagdish Eashwar