open(FH, "+< FILE") or die "Can't open file: $!"; @file_array = ; # perverse, abuse, and do stuff to array here seek(FH, 0, 0); print FH @file_array; truncate(FH,tell(FH)); close(FH);