in reply to I thought I understood split...
The purpose of split is to parse a separated list into its elements. There's no separator between the fields on which to split, making split the wrong choice. Use the match operator (m//) instead.
my ($year,$mon,$day,$hour,$min) = $date =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})\z/;
If you're not trying to validate, you can use unpack a bit more cleanly here:
my ($year,$mon,$day,$hour,$min) = unpack('A4 A2 A2 A2 A2', $date);
|
|---|