in reply to Add leading zeros to days/months in dates while parsing CSV
It's probably something in that part of the code which you haven't shown us (or in your data). This works fine for me:
#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 1; my @have = ('1/2/2003', '4/5/2006', '10/11/2012'); my @want = ('2003-01-02', '2006-04-05', '2012-10-11'); $_ = sprintf '%04d-%02d-%02d', (split m:/:)[2,0,1] for @have; is_deeply (\@have, \@want);
|
|---|