my $numeric_string = '0010030511'; my $first_three_digits; $first_three_digits = $1 if $numeric_string =~ s/^(\d{3})//;