opening a file in perl
Jeremy
jepri at webone.com.au
Wed May 1 18:17:26 EST 2002
On 2002.05.01 10:38 Matthew Hawkins wrote:
> On Wed, 01 May 2002, Nemo - earth native wrote:
> > foreach my $line ( <IN> )
>
> The other thing is (and I don't know how valid this is with newer
> versions of Perl) you're better off declaring $line outside the
> foreach,
> as the way you have it a new $line is malloced each iteration, and its
> up to the garbage collector to nuke the old one.
It's OK. Perl caches the memory - it never releases it back to the
system. When you define line again, it tries it's own memory cache
allocator thingy first, then heads out to the system to get it.
>
> --
> Matt
>
>
More information about the linux
mailing list