in reply to splitting a string into arbitrary lengths
my ($tyear, $tmon, $tday) = unpack( 'A4A2A2', '20050622' );
If you choose to use this, you might also want to read pack and perlpacktut