in reply to Problem printing @arrays

I suspect you are reading a file created with \r\n (carriagereturn-linefeed) line endings (e.g., on a Windows system) on a system (e.g., *nix) that uses \n (linefeed) line endings. On the reading system, the line-feed is chomp-ed off leaving the carriage-return. This can be simulated with something like:

Win8 Strawberry (32) Fri 09/03/2021 23:52:22 C:\@Work\Perl\monks >perl use strict; use warnings; use Data::Dump qw(dd); my $data = <<"EOD"; AA\r AAH\r AAHED\r AAHING\r AAHS\r AAL\r ZYTHUMS\r ZYZZYVA\r ZYZZYVAS\r ZZZ\r ZZZS\r EOD open my $fh, '<', \$data or die $!; my @words = <$fh>; close $fh; dd \@words; chomp @words; dd \@words; print "@words\n"; ^Z [ "AA\r\n", "AAH\r\n", "AAHED\r\n", "AAHING\r\n", "AAHS\r\n", "AAL\r\n", "ZYTHUMS\r\n", "ZYZZYVA\r\n", "ZYZZYVAS\r\n", "ZZZ\r\n", "ZZZS\r\n", ] [ "AA\r", "AAH\r", "AAHED\r", "AAHING\r", "AAHS\r", "AAL\r", "ZYTHUMS\r", "ZYZZYVA\r", "ZYZZYVAS\r", "ZZZ\r", "ZZZS\r", ] ZZZSYVAS

Give a man a fish:  <%-{-{-{-<