home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7630 < prev    next >
Encoding:
Internet Message Format  |  1992-12-30  |  1001 b 

  1. Path: sparky!uunet!cs.utexas.edu!uwm.edu!spool.mu.edu!hri.com!noc.near.net!meiko.com!mike
  2. From: mike@meiko.com (Mike Stok)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Perl range operator
  5. Keywords: range
  6. Message-ID: <1992Dec30.213957.12963@meiko.com>
  7. Date: 30 Dec 92 21:39:57 GMT
  8. References: <1992Dec30.131700@se28.wg2.waii.com>
  9. Sender: news@meiko.com
  10. Organization: Meiko Scientific Corp.
  11. Lines: 23
  12.  
  13. In article <1992Dec30.131700@se28.wg2.waii.com> starr@wg2.waii.com writes:
  14. >In some recent work I was doing, I noticed the following:
  15. >
  16. >    @x = (10..1);
  17. >
  18. >doesn't generate the range 10 -> 1, as one might expect.  Is there a
  19. >reason it doesn't work this way?
  20.  
  21. 'cos it uses the magical autoincrement algorithm (according to p90 of
  22. the Camel book), and autodecrement isn't magical (p81)...
  23.  
  24. Not to worry, 
  25.  
  26.     @x = reverse (1 .. 10);
  27.  
  28. is not too obscure :-)
  29.  
  30. Mike
  31. --
  32. The "usual disclaimers" apply.    |
  33. Mike Stok                         |
  34. mike@meiko.com                    |
  35. Meiko tel: (617) 890 7676         |
  36.