sierrastar has asked for the wisdom of the Perl Monks concerning the following question:
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]/); } #stor in $1 $2 $3 and format for international phone format $phone=~/ddd)(ddd)(dddd)/; $formattedphone="+"."1"." ".$1." ".$2." ".$3;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regular expressions and match variables
by sauoq (Abbot) on Nov 07, 2005 at 01:42 UTC | |
by sierrastar (Sexton) on Nov 07, 2005 at 01:52 UTC |