in reply to capture multiple lines

You could just chomp each line as you read it in:
my @txtfile; while (<$fh>) { chomp; push @txtfile, $_; }

Alternately, after you have read the file into your array, chomp the whole array:

chomp @txtfile;