in reply to reading files in @ARGV doesn't return expected output

My mind is very much elsewhere at the moment but if nobody else has the time to review and answer in the next bit I'll revisit. That said, why are you using @ARGV like that? This special variable is an array that contains values sent in on the command line; eg:

if (! @ARGV){ die "need an argument..."; } my $username = $ARGV[1];

etc. Then, your command line command:

perl script.pl STEVIEB

Use a lexical array instead. Using @ARGV the way you are is kind of a head-scratcher when initially glancing at the code.

Replies are listed 'Best First'.
Re^2: reading files in @ARGV doesn't return expected output
by Anonymous Monk on Jun 26, 2017 at 23:50 UTC

    Seems to be an attempt to not use explicit open() by use of while ( ... = <> ){ } later in the code.

      Indeed, but it's not typical usage, and if I were to see something like that in a large project (something I deal with frequently) I'd either be confused, second guessing things immediately or wondering wtf else is odd like this that could be leading to issues :)