general form of the phone number => three digits, followed by a -, followed by three digits, followed by a -, followed by four digits.
\d matches a single digit. {n} matches the previous match n times (e.g. \w{5} matches five word characters in a row) - outside of [] matches a - (inside [], it specifies a range, e.g. [a-z] matches any lowercase alp +habetic character.)
the rest is left as an exercise for the reader. Open book exam: perldoc perlre. Good luck, you have fifteen minutes!
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
In reply to Re: Another LostS Question - Phone Number Checks
by arturo
in thread Another LostS Question - Phone Number Checks
by LostS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |