powerhouse has asked for the wisdom of the Perl Monks concerning the following question:
I need to get the users input for tech support, I have a dialer that will call them back for the support, but the phone number can only be ten digits long. So first I want to get ONLY the numbers, then I can play with it, like if it is 11 digits in length, and the first digit is a 1 then I will have it drop off the one. My problem is that I cannot get it to work, it does not strip off anything.
Does this not work:
$phone =~ s/!(^\d+)//g;
I've searched a few sites, including this one, usually for the terms, "phone number only", "numbers only" "strip everything but numbers" and so forth, but found nothing.
Does this not work:
$phone =~ s/!(^\d+)//g;
I've searched a few sites, including this one, usually for the terms, "phone number only", "numbers only" "strip everything but numbers" and so forth, but found nothing.
thx,
Richard
Richard
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Numbers only in a string
by sk (Curate) on Sep 08, 2005 at 15:51 UTC | |
by superfrink (Curate) on Sep 09, 2005 at 05:02 UTC | |
Re: Numbers only in a string
by davido (Cardinal) on Sep 08, 2005 at 15:51 UTC | |
Re: Numbers only in a string
by socketdave (Curate) on Sep 08, 2005 at 16:01 UTC | |
Re: Numbers only in a string
by trammell (Priest) on Sep 08, 2005 at 16:26 UTC | |
Benchmark time: Numbers only in a string
by polettix (Vicar) on Sep 08, 2005 at 17:26 UTC | |
Re: Numbers only in a string
by saberworks (Curate) on Sep 08, 2005 at 16:01 UTC | |
by davidrw (Prior) on Sep 08, 2005 at 16:23 UTC | |
Re: Numbers only in a string
by sh1tn (Priest) on Sep 08, 2005 at 16:34 UTC | |
Re: Numbers only in a string
by Roy Johnson (Monsignor) on Sep 09, 2005 at 12:06 UTC |
Back to
Seekers of Perl Wisdom