in reply to Problem printing @arrays

Try replacing

chomp (my @words = <$fh>);
with
tr/\r\n//d for my @words = <$fh>;
which will also remove the \r if present.

Replies are listed 'Best First'.
Re^2: Problem printing @arrays
by sbrothy (Acolyte) on Sep 04, 2021 at 15:45 UTC

    Thank you Tybalt89. That did the trick. I'ts kinda funny though, I had a working script based on one of your older posts here.

    At that time it worked fine. Possibly I downloaded the file from somewhere else this time.

    I have other issues now but I will give 'em a go before asking for help again.

    Thank you!