in reply to Re: @ARGV while (<>) hangs
in thread @ARGV while (<>) hangs

It's a really bad idea to modify globals (@ARGV and $_ in this case) without localizing them.
local @ARGV = ...; local $_; while (<>) { ... }