Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!hp4nl!ruuinf!piet From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.lang.perl Subject: Re: Strange while behaviour in sub ? Message-ID: <4827@ruuinf.cs.ruu.nl> Date: 12 Feb 91 12:52:32 GMT References: <1991Feb06.011642.14065@sdd.hp.com> <11323@jpl-devvax.JPL.NASA.GOV> Sender: news@ruuinf.cs.ruu.nl Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, Utrecht University, The Netherlands Lines: 27 In-reply-to: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) >>>>> In message <11323@jpl-devvax.JPL.NASA.GOV>, lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (LW) writes: LW> Yes, has a built-in state, just as has a built-in LW> state. Almost correct. The built-in state is in , but not in . Rather it is in the filehandle itself, which means that multip;le occurrences of share the same state (as long as they refer to the same filehandle, meaning no locals, no open/close. It is a pity you can't associate a file handle name to a globbing pattern, but on the other hand you can always dump the thing in an array and work from that. LW> The each() function works similarly--it has a built-in iterator that LW> returns false only once before starting over. And in this case the state is in the ASSOC array. There aren't many constructs that have state in the TEXTUAL OCCURRENCE. ?pattern? and /$regexp/o come to my mind, but the difference is crucial. -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')