Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!mcnc!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: Recursive use of iterators Message-ID: <1991Apr3.233616.11680@uvaarpa.Virginia.EDU> Date: 3 Apr 91 23:36:16 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 25 I was writing a recursive function that contained a foreach statement, so I made sure to localize the array it was iterating over: local(@dependencies) = ...; foreach (@dependencies) {...} Somewhat to my surprise, the recursive execution of the loop interfered with the proper operation of the outer execution. I found that I have to localize the symbol table entry (if that's how you say it): local(*dependencies); @dependencies = ...; foreach (@dependencies) {...} This is probably not a bug, but it led me to wonder how you deal with recursive loops like: foreach $i ($a .. $b) {...} Dale Dale Worley Compass, Inc. worley@compass.com -- And then there is the scientific problem known as "Schroedinger's pussy"...