my $stuff = 'file.txt'; open(F, "$stuff") || die "Can not open file: $!\n"; my @records = (); print "@records\n"; s/lastlineofdata//; #This is the part I am struggling with close(F);