I'm not sufficiently knowledgeable about Macintosh resource forks to help you directly with that aspect of your question; however, here's some tips that may be useful:
-
You're opening a number of files in append mode but using a die() message with "Error reading ...". Try adding $! to the message to get the real reason (or at least a better reason) why open() failed. Also consider using the (preferred) 3-argument form of open(). The documentation for open has examples of both of these.
-
You're building quite a few pathnames manually. Consider using File::Spec for these tasks: the functions catfile() and catdir() look like the most useful candidates here. If nothing else, it will eliminate all the . "/" . parts you're currently typing in.
-
Add use strict; and use warnings; to the top of your code (immediately after #!/usr/bin/perl). You can get more informative messages by also adding use diagnostics;.