my $conn = MongoDB::Connection->new; my $db = $conn->mydb || die "$!"; my ($col, $cols, @cols, $q, $doc, @b, @c, @new, $x, $date, $l, $host); @cols = $db->collection_names; foreach $cols (@cols) { #### if ( @new > 1 ){ foreach my $xxx (@new){ print '@new = '.strftime('%Y-%m-%d', localtime($xxx))."\n"; } $col->update( { "host" => $host }, { '$set' => { "timestamp" => @new } }, { 'multiple' => 1, 'safe' => 1 } ) || die "$!";