home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / question / 15826 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  2.0 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!ucsbcsl!engrhub!harley
  2. From: harley@engrhub.ucsb.edu (Harley Hahn,,,HAHN,personal)
  3. Newsgroups: comp.unix.questions
  4. Subject: The Fundamental Theorem of Perl
  5. Message-ID: <7447@ucsbcsl.ucsb.edu>
  6. Date: 22 Jan 93 03:10:25 GMT
  7. References: <1993Jan15.230411.2512@nas.nasa.gov> <51845@seismo.CSS.GOV> <1993Jan19.181113.16935@news.eng.convex.com>
  8. Sender: root@ucsbcsl.ucsb.edu
  9. Lines: 47
  10.  
  11. Recently, a simple solution to a sorting problem...
  12.  
  13. >:The following sort command works just fine:
  14. >:sort -t. +0n -1 +1n -2 +2n -3 +3n -4
  15. >:
  16. >:With some small changes this could sort the internet number anywhere in the
  17. >:line.
  18.  
  19. was offered.  However, Tom C. showed how for difficult data
  20. the simple solution might not be enough...
  21.  
  22. >Really?  Please show me how to sort the following lines by the
  23. >first occurring Internet address on each line:
  24.  
  25. {omit sample data in which numbers are irregular}
  26.  
  27. >I believe you cannot without great effort devise a /usr/bin/sort solution
  28. >where the Internet number falls in different places on different lines, or
  29. >one in which the host number is a class A or B address in two- or three-dot
  30. >notation.  The following hunk of perl code, on the other hand, manages
  31. >quite well:
  32.  
  33. {omit clever Perl program}
  34.  
  35. ------------
  36.  
  37. I think I have just figured out the Fundemental Theorem of Perl:
  38.  
  39.                    =====================================
  40.                      THE FUNDAMENTAL THEOREM OF PERL
  41.                    =====================================
  42.  
  43.                    As you make a problem more and more complex,
  44.                    you will eventually reach the point where it
  45.                    becomes necessary to use Perl.
  46.  
  47.                    ==================
  48.                    Harley's Corollary:
  49.                    ==================
  50.                    Any problem can be made to require Perl
  51.                    by expanding the set of input data to be 
  52.                    sufficiently complex.
  53.  
  54.                    =====================================
  55.  
  56.  
  57. -- Harley Hahn
  58.