Perl Programming quiz, level Advanced, question 8
| Question: | Which of the following regular expressions matches the first number in $_ and returns the whole part into $whole, and any part after a decimal point, into $deci? |
| Answer 1: | ($whole,$deci) = /(?:(\d*)\.?(\d+))|(?:(\d+)\.?(\d*))/; This was the CORRECT answer |
| Answer 2: | ($whole,$deci) = /((\d+)\.(\d+))|(\d+)/; |
| Answer 3: | ($whole,$deci) = /(\d+)\.(\d*)/; |
| Answer 4: | ($whole,$deci) = /(?:([0-9]*\.([0-9]*)){3,}/; |
This was a question from our quiz ... but we have now provided you with
the answer (above) - we prefer to provide you with information rather than to
puzzle you.
|
|