# you could use this: my ($month, $day, $year) = unpack('a4 a2 a2', $date); # instead of this: my $year = substr($date,0,4); my $month = substr($date,4,2); my $day = substr($date,6,2);