Can you assist me in determing correct $string = line to end up with partial_phone containing 4165867111?
sub phoneno {
my ($string) = @_;
$string =~ s/^\+*0*1*//g;
return $string;
}
my $phone = "<sip:+4165867111@something;tag=somethingelse>";
my $partial_phone = phoneno($phone);
Your substitution starts with a
^, which means it won’t perform substitution unless the rest of your pattern matches the start of your string.There are lots of ways to do this. How about
This returns any string of digits that doesn’t begin with a 0 or 1.