local $/ = '****'; my @whole = ; print NEWFILE pop @whole; #you might want to stick it in a temp scalar first to make it clearer... some people think print() with side effects is unclear print OLDFILE @whole;