- ALWAYS check the return value from open and show the error: open( ... ) or die qq{Problem opening '$ARGV[0]': $!\n};
- If you'd use a hash like I suggested rather than an AoA it'd be more efficient; you're doing a linear search over all of your filenames repeatedly whereas a hash can just do exists
Those nitpicks aside, seeing as that's basically my suggestion above . . . looks sane. (Sanity not guaranteed. Contents may have settled during shipping. Prices may be higher in AK and HI.)
Edit: tweaked wording of second item slightly. Me no make sense much early morning do.
The cake is a lie.
The cake is a lie.
The cake is a lie.