Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ukma!psuvax1!psuvm!blekul11!ffaac09 From: FFAAC09@cc1.kuleuven.ac.be (Paul Bijnens) Newsgroups: comp.lang.perl Subject: How to make a local(FILEHANDLE)? Message-ID: <91151.182227FFAAC09@cc1.kuleuven.ac.be> Date: 31 May 91 18:20:27 GMT Organization: K.U.Leuven - Academic Computing Center Lines: 26 I have a filehandle that is only used in a subroutine. To avoid stepping on some other global filehandle, how do I make this filehandle local to this subroutine. I cannot use local(), because its elements must be legal lvalues. I want to do something like this: sub makeassoc { # learn file freqtop by heart local(FH); # this is illegal...??? open(FH, "/usr/local/lib/freqtop") || die("Oops, freqtop: $!\n"); while () { chop; $top{$_}++; # %top is a global array } close(FH); } An ugly workaround I use now: open(F1934547838, "..."); and hope to not use the same number twice by accident. (Perl 4.0, pathlevel 3 if it matters) -- Polleke (Paul Bijnens) Linguistics dept., K. University Leuven, Belgium FFAAC09@cc1.kuleuven.ac.be