Thanks for the great answers, and sorry for not having followed the right etiquette of this website. I am not a programmer, and I started using perl only two weeks ago.
So: I have tried to locate where perl is installed: /usr/bin/perl. However, I also see perl5.8.9 and 5.10.0. Furthermore, for some reasons cpan won't let me install modules, so I have basically been copy-pasting the source of the .pm module files I needed, and put them in the relative folders (i.e. HTML/TreeBuilder folder for XPath.pm). Most of these folders, I have no idea why, are located in /System/Library/Perl/Extras/5.10.0/, so that's where I put the files. Both XPath and Scraper are in subfolders of this folder. I know this is not how I should work, but I just couldn't figure out anything better when I started working and only now I realize that I probably made a huge mess.
What would you guys recommend to solve this problem? Where should the folders be located?
Thanks a lot for your precious help!