Firstly, you slurp the entire file into memory with the line that reads @file = <FILE>;. Secondly, you loop over each line of the file many many times. Also, not relating to your problem per se, but you are using an array that contains a single array reference and it doesn't look like there's any reason for that (@ranges will always have one element, the reference to your 4 values. Similar for @range_counts since it's built from @ranges).
In reply to Re: inefficient code? works on small files ok but not larger ones
by duff
in thread inefficient code? works on small files ok but not larger ones
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |