Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!uakari.primate.wisc.edu!aplcen!haven!decuac!hadron!netxcom!elw From: elw@netex.netx.com (Edwin Wiles) Newsgroups: comp.lang.perl Subject: Local file handles? Keywords: FILEHANDLE LOCAL Message-ID: <9317@netxcom.DHL.COM> Date: 7 Nov 90 18:32:38 GMT Sender: news@netxcom.DHL.COM Organization: NetExpress Inc., Vienna, VA, USA Lines: 30 Originator: elw@netex I'm coding around the problem, but I'd like to know for future reference. Is there any way to declare a file handle to be local to a given subroutine? I didn't actually try this, and I don't think it would work, but it should get the idea across: sub Arecursive { local($somefile, @somejunk) = @_; open( local(INPUT), "< somefile" ); # This is the sticky line. while( ) { ... @Bvalue = Arecursive( $_, @morejunk ); # This is why I want ... # "local(INPUT)". } close( INPUT ); return @Avalue; } As you will notice, the routine doesn't really do anything. It just embodies the idea that I wanted to show: Having "INPUT" be a filehandle which is local to an instance of a recursive subroutine. I've decided to code it so that all the IO occurs *before* the recursive call, but it might have been nice to not have to do that... -- Prefered.: elw@netx.com Edwin Wiles Alternate: ...!grebyn!netex!elw NetExpress Inc., Suite 300, Who? Me?!? Responsible!?! Surely You Jest! Vienna, VA, USA 22182