in reply to Re: wisdom needed for string matching and array processing
in thread wisdom needed for string matching and array processing
thanks#Get the phone number and check to make sure that it contains only dig +its and the length is 10 while($phone =~ /D/ || $len !=10){ print "Please enter your 10 digit phone number:"; $phone = <STDIN>; chomp($phone); #Find out the length of the string $len=($phone=~tr/[0-9]/[0-9]/); } #Using regular expressions, break down the phone number into first num +ber the #next three digits and then the next three digits and so on. Each digi +ts will be #stored in $1 $2 $3 and $4. $phone=~/(d)(ddd)(ddd)(ddd)/; $formattedphone="+".$1." ".$2." ".$3." ".$4;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: wisdom needed for string matching and array processing
by skx (Parson) on Nov 07, 2005 at 05:31 UTC |