home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7063 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.5 KB  |  46 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!wupost!gumby!destroyer!ncar!csn!news.den.mmc.com!dino!snorman
  3. From: snorman@den.mmc.com ( Stephen P. Norman )
  4. Subject: Programming Perl: Pages 55-56?
  5. Message-ID: <1992Nov19.232606.18371@den.mmc.com>
  6. Keywords: perl, question
  7. Sender: news@den.mmc.com (News)
  8. Nntp-Posting-Host: dino.den.mmc.com
  9. Reply-To: snorman@den.mmc.com
  10. Organization: Martin Marietta Astronautics Group
  11. Distribution: usa
  12. Date: Thu, 19 Nov 1992 23:26:06 GMT
  13. Lines: 31
  14.  
  15. I have just bought Programming Perl, First edition, March 1992 printing.
  16. On pages 55 to 56, (Chapter 1, Recursion) there is an example program on 
  17. building and descending an associative array (Job and his decendants). 
  18. I have carefully replicated this program on-line and it does not seem to 
  19. work for me:
  20.  
  21. 1) The routine 'do_a_begat': how does this routine dereference $parent{$name},
  22.    which appears to be local to the routine 'load_kids'?
  23.  
  24. 2) My version does not print out any results, as $parent{$name} is null
  25.    in the routine 'do_a_begat'.
  26.  
  27.    So I tried the following:
  28.  
  29.    a) changed $parent{$name} in 'load_kids' to $tree{$name}
  30.    b) changed $parent{$name} in 'do_a_begat' to $tree{$name}
  31.  
  32.    I now seem to get some results that make sense.
  33.  
  34. 3) Am I missing something, or does this example really not work as written?
  35.  
  36. 4) Are the example programs in this book on-line anywhere?
  37.  
  38.  
  39. Thanx for any tips - I am new to perl...
  40.  
  41. Steve Norman
  42. Martin Marietta Astronautics Group
  43. PO Box 179
  44. Denver CO 80201
  45.  
  46.