in reply to uninitialized variable

In a subroutine, you need to use @_ not @ARGV. @ARGV is only for parameters passed into the script when invoking it (ie, from the command-line). @_ is where subroutine parameters are passed.

So change all the lines that say shift(@ARGV) to shift(@_) and it should be fine.

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.