Às 11:33 de 17/04/22, wilson escreveu:
hello the experts,

can you help check my script for how to optimize it?
currently it was going as "run out of memory".

$ perl count.pl
Out of memory!
Killed


My script:
use strict;

my %hash;
my %stat;


To be honest you don't need the %stat, however you'll need to go through the %hash several times for the average calculation. It will also make the script more unreadable.

You can also read the file several times, and on each time extract only the values of only one item.

The best option is for you to use a profiler to figure it out where the most memory is being consumed...


Good luck.

Regards,
David Santiago

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to