I don't think you're going to get a good answer for this question without more details about how your hardware works. Try to find other users of this hardware, or similar hardware. You should be able to find some sample code - don't worry if it's not Perl. If you can, post it here and we'll help you figure out how to do it in Perl.
-sam