in reply to Parsing a string for sorting
You could also convert the string to an array:my $numeric_string = '0010030511'; my $first_three_digits; $first_three_digits = $1 if $numeric_string =~ s/^(\d{3})//;
Update: Foolish me. I forgot the power of substr oh well. TIMTOWTDI.my @numeric_string = split//, '0010030511'; my $first_three_digits = join '', splice @numeric_string, 0, 3;
|
|---|