Utiliser une table matrice dans un hash plutôt que dans un tableau, et utiliser la fonction tie pour le lier à un fichier DB :
#!/usr/local/bin/perl
use strict;
use IO::Handle;
use DB_File;
STDOUT -> autoflush(1);
my %h;
my $db = tie(%h,'DB_File',"tmp_file.db") or die $!;
my $x;
my $y;
for($x = 0; $x < 10000; $x++)
{
for($y = 0; $y < 10000; $y++)
{
$h{$x,$y} = rand(100);
print ".";
}
}
$db -> sync();
untie(%h);
Plus d'informations dans la documentation de Perl :