Using store function to save array to a file
use Storable; @a = (1, 2, 3); store(\@a, "array.dat"); @a2 = @{retrieve("array.dat")}; print $a2[1];