use strict; use warnings; my $u = 70; # Number of underscores my $t = join '',; substr($t,0,index($t,"\n".'_'x$u."\n")+$u+2) = ''; print $t; __DATA__ Junk data goes here ______________________________________________________________________ Useful data goes here