Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

I. Exercises > 17. Some Advanced Perl Techniques

Chapter 17. Some Advanced Perl Techniques

17.1. Write a program that repeatedly asks the user for a string and a regular expression then reports if the string matches the regular expression. What happens if you give your program an invalid regular expression? How can you fix that? If you can’t think of an invalid regular expression, try one with an unmatched ( or [. (Answer to Exercise 17.1)

17.2. Rewrite your answer to Exercise 17.1 to use Try::Tiny instead of eval (or, if you used Try::Tiny in the previous exercise, try it with eval). (Answer to Exercise 17.2)

17.3. Use the grep function to select the multiples of 3 between 1 and 1,000. (Answer to Exercise 17.3)

17.4. Use the map function to create a list of the squares of the numbers from 1 to 10. (Answer to Exercise 17.4)


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint