home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7370 < prev    next >
Encoding:
Internet Message Format  |  1992-12-11  |  1.3 KB

  1. Path: sparky!uunet!cs.utexas.edu!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: [Q] Ref. to array element ?
  5. Message-ID: <1992Dec11.171440.7890@netlabs.com>
  6. Date: 11 Dec 92 17:14:40 GMT
  7. References: <1992Dec9.153252.16741@siemens.co.at> <1992Dec10.013324.2328@yarra-glen.aaii.oz.au> <1992Dec10.075930.28572@cs.ruu.nl>
  8. Sender: news@netlabs.com
  9. Organization: NetLabs, Inc.
  10. Lines: 22
  11. Nntp-Posting-Host: scalpel.netlabs.com
  12.  
  13. In article <1992Dec10.075930.28572@cs.ruu.nl> piet@cs.ruu.nl (Piet van Oostrum) writes:
  14. : >>>>> pem@yarra-glen.aaii.oz.au (Paul E. Maisano) (PEM) writes:
  15. : PEM> Here's a sub that will return the symbol table entries (globs?)
  16. : PEM> for each scalar passed.
  17. : PEM> Eg. (*a, *b) = &ref($x, $y[1])
  18. : PEM> `a' now refers to whatever `x' did and `b' should refer to whatever
  19. : PEM> y[1] did.
  20. : PEM> I wrote it a long time ago but I have never used it for anything.
  21. : PEM> It uses the fact that the grep function makes $_ a reference to each
  22. : PEM> scalar in the given array.
  23. : Will this also work in perl 5?
  24.  
  25. There's a good chance of it, though you should realize that it probably
  26. generates symbol table entries that are rarely (if ever) reclaimed.
  27. It would likely be better to use real references in Perl 5.
  28.  
  29. Larry
  30.