in reply to Re: wisdom needed for string matching and array processing
in thread wisdom needed for string matching and array processing

thank you your code is much more eloquent than mine...but I think I am learning - do you have any suggestions as to why the phone number is only printing out a "+" here is that code again:
#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;
thanks

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

    Read the reply more carefully - the answer was given. The mistake you made in the same sample is the same as the mistake you made in the second.

    (I'm not trying to tease and withold the answer - but if it is homework then thinking about the problem and reading the reply you've recieved carefully should be a good thing for you!)

    Steve
    --