open (FILEHANDLE, ">array.dat") or die ("Cannot open array.dat"); $, = "\n"; #Set output separator to a comma @array = (1, 2, 3); print FILEHANDLE @array; close FILEHANDLE;