Maybe fragmentation from extending the stack is using up a lot of memory. Try to avoid putting the entire file on the stack, and pre-extending its destination:
my @lines; $#lines = 12_000_000; @lines = (); push @lines, $_ while <IN>;
Note that shuffle already exists in List::Util.
Update: Fixed bug.
In reply to Re: mem usage
by ikegami
in thread mem usage
by halfcountplus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |