[Columbus-pm] weird datetime / push behavior
Jonathan Hogue
jon at hogue.org
Tue May 18 12:51:42 PDT 2010
see this sample script.
use strict;
use DateTime;
use Data::Dumper;
my $d = DateTime->now;
my @days;
foreach my $i ( 1..7 )
{
push( @days, $d );
$d->add( 'days' => 1);
}
print Dumper \@days;
It adds the first datetime object... but isn't doing what you expect
for the next iterations... what's going on here?
$VAR1 = [
bless( {
.....
}, 'DateTime' ),
$VAR1->[0],
$VAR1->[0],
$VAR1->[0],
$VAR1->[0],
$VAR1->[0],
$VAR1->[0]
];
More information about the Columbus-pm
mailing list