Question
Using regular expressions, write a complete Perl script that, when given the input from a sample as shown below, displays ONLY the valid phone numbers
Using regular expressions, write a complete Perl script that, when given the input from a sample as shown below, displays ONLY the valid phone numbers found anywhere in the file. For this example assume a phone number is valid only if it is in the following form (where 9 represents anynumber):
(999)-999-9999
Sample Input:
this is a test 12345676867 (123)-456-7890 My number: (123)-555-1212 test 9999 test. A phone number ((123)-999-0000) exists on this line. There is no phone number ((123)-999+0000) on this line. |
Sample Output:
(123)-456-7890 (123)-555-1212 (123)-999-0000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started