Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: script gobbles up memory Message-ID: <1991Mar01.023843.1282@convex.com> Date: 1 Mar 91 02:38:43 GMT References: <291@carssdf.UUCP> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 31 Nntp-Posting-Host: pixel.convex.com From the keyboard of usenet@carssdf.UUCP (John Watson): :Most of my scripts look something like this: : :while (<>) { chop; @F=split(/_/); : .... some code for each line .... :} : :This gobbles up memory. If I add a "reset 'F';" line in the loop, it is :fine. Should I need to do this? If necessary, why wouldn't a line of :"undef @F;" work? (it doesn't). Yes, undef should work fine. What patchlevel of perl are you at and on what hardware/software platform? Actually, you shouldn't even need that, since each successive assignment to @F should in theory free of the memory associated with the previous values. A couple of miscellaneous asides... Don't you mean: @F = split(' '); (Unless you really have underbars as field separators.) Also, you say that most of your scripts to the split(). They'll run a little faster if you only split when you need to. --tom -- "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." -- Doug Gwyn Tom Christiansen tchrist@convex.com convex!tchrist