# create the file if it does not exist use Fcntl 'O_RDWR', 'O_CREAT'; tie @array, 'Tie::File', $file, mode => O_RDWR | O_CREAT;