in reply to Another LostS Question - Phone Number Checks
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"'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Another LostS Question - Phone Number Checks
by mandog (Curate) on Aug 23, 2001 at 23:37 UTC | |
by LostS (Friar) on Aug 23, 2001 at 23:42 UTC | |
|
Re: Re: Another LostS Question - Phone Number Checks
by LostS (Friar) on Aug 23, 2001 at 23:06 UTC | |
by kjherron (Pilgrim) on Aug 24, 2001 at 00:24 UTC | |
by Brovnik (Hermit) on Aug 28, 2001 at 15:22 UTC |