in reply to Simple Regex

I think you mean the first

*10*digits are the phone number, not the first*7*.If you can assume that the first 10 digits are the phone number, and the remaining digits are the extension (which is a big assumption):

# Get rid of all non-digits $number =~ s/\D//g; # Break the number into groups of digits my $phone = substr($number,0,10); my $extension = substr($number,10);

buckaduck

In Section
Seekers of Perl Wisdom