Perl memory policy

Perl memory policy

am 01.09.2005 19:23:41 von ozy

Hi guys!

I have some code which could be reduced to the following...
--------------------
my @unsorted;
open( FH, 'test_data.txt' );

while ( ){
chomp $_;
push @unsorted, $_;
}

close( FH );
--------------------

The file that we are reading is quite simple: a single 0 in every line,
but the size is about 12Mb (and will be way bigger in the real
enviroment)

We are using v5.6.1 built for MSWin32-x86-multi-thread (Binary build
635 provided by ActiveState Corp)

My questions would be:
- could the snippets be written somehow else to be more effective in
sight of memory usage?
- what is the actuall memory policy of perl? Just because it is using
way more that i would except... (using 600+ Mb at the end) (I know hoe
TCL handles memory allocation but I can't find a clue about Perl's
behaviour )
- do I have any option to influence this policy?

thanks in advance!

ozy