#!/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);