home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7642 < prev    next >
Encoding:
Text File  |  1992-12-31  |  848 b   |  28 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!usc!news.cerf.net!netlabs!lwall
  3. From: lwall@netlabs.com (Larry Wall)
  4. Subject: Re: Perl range operator
  5. Message-ID: <1992Dec31.205009.26114@netlabs.com>
  6. Keywords: range
  7. Sender: news@netlabs.com
  8. Nntp-Posting-Host: scalpel.netlabs.com
  9. Organization: NetLabs, Inc.
  10. References: <1992Dec30.131700@se28.wg2.waii.com>
  11. Date: Thu, 31 Dec 1992 20:50:09 GMT
  12. Lines: 14
  13.  
  14. In article <1992Dec30.131700@se28.wg2.waii.com> starr@wg2.waii.com writes:
  15. : In some recent work I was doing, I noticed the following:
  16. :     @x = (10..1);
  17. : doesn't generate the range 10 -> 1, as one might expect.  Is there a
  18. : reason it doesn't work this way?
  19.  
  20. So that @x = ($min .. $max) doesn't suddenly do counterintuitive things when
  21. $max decreases to less that $min.  You can always do what you want with
  22.  
  23.     @x = reverse(1..10);
  24.  
  25. Larry
  26.