It would probably help you immensely if you followed these oft-spoken guidelines while debugging your code:
- Always use strict;. This would have pointed out a few of your problems right away.
- Always check to see if your system functions succeeded or failed. Specifically, your open call.
- Always use strict;.
- When debugging, run your script using Perl's -w flag (or use warnings; in Perl 5.6). This tends to point out other things you're doing wrong.
In your first chunk of code, your
open call is missing an argument. In your third chunk of code, you're opening the LL file handle but reading from the PM file handle. Again, 'use strict' and '-w' would have caught this. As far as the array in the 2nd chunk of code, perhaps it's failing to open the file for some reason? Check for the success/failure of
open to see.
Hope this helps.