in reply to How to split unique patterns

First, your split creates a couple of empty fields caused by the double colons present. Secondly, the "hh" is still part of "123-456 hh", is this intentional?

If you want to stick to split, you could re-join hh with mm afterwards:

use strict; use warnings; use Data::Dumper; my $line = "A::B:123-456 hh:mm:C::D:789"; my @array = split /:/, $line; print Dumper \@array; splice @array, 3, 2, join( ":", @array[ 3..4 ] ) ; print Dumper \@array;