in reply to why is my pm not finding the correct files

tangledupinperl:

Based on the code and message you printed, it looks like your position1 function returns 0 when it fails. I'd suggest you use the debugger to set a breakpoint in your loop and/or in position1 and find out what values you're passing in.

If the debugger is too intimidating right now, add a few print statements to the code to print variable values. I'd suggest printing the arguments to position1 and the return value, so you can see what's happening. Note: Data::Dumper is quite useful for this!

...roboticus