#!/usr/bin/perl use strict; open(FILE, "+) {     push @array, $_; } seek FILE,0,1; truncate FILE, 0; print FILE @array; close(FILE);