in reply to Has my Perl Go Crazy?

For a start: don't use global variables - you never know where they've been.

Always use strictures (use strict; use warnings; - see The strictures, according to Seuss).

Use the three parameter version of open.

or die ... will cause you less grief than || die ....

Investigate readdir and File::Find.


Perl reduces RSI - it saves typing