home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5638 < prev    next >
Encoding:
Text File  |  1992-08-31  |  854 b   |  25 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!indetech!cirrus!dhesi
  3. From: dhesi@cirrus.com (Rahul Dhesi)
  4. Subject: Re: randomize.c
  5. Message-ID: <1992Aug31.183903.4143@cirrus.com>
  6. Sender: news@cirrus.com
  7. Organization: Cirrus Logic Inc.
  8. References: <Btrt40.G6o@zardoz> <Bts28y.DJA@rahul.net> <AAS.92Aug31133620@rosmer.nr.no>
  9. Date: Mon, 31 Aug 1992 18:39:03 GMT
  10. Lines: 13
  11.  
  12. In <AAS.92Aug31133620@rosmer.nr.no> aas@rosmer.nr.no (Gisle Aas) writes:
  13.  
  14. >Why not:    perl -e '@l=<>;print splice(@l,rand($#l),1) while @l'
  15.  
  16. I considered using splice and decided not to take the risk of a
  17. possibly inefficient implementation.  Later I was told that the perl
  18. book already has such a program.
  19.  
  20. Just how efficient is splice?  I guess it depends on whether arrays in
  21. perl are internally implemented as linked lists.
  22. -- 
  23. Rahul Dhesi <dhesi@cirrus.com>
  24. also: dhesi@rahul.net
  25.