use Data::UUID; my $string = Data::UUID->new->create_str; $string =~ tr [\-abcdef] [9012345]; my $first_10 = substr($string, 0, 10);