in reply to problem with INC

Because use is evaluated at compile-time you need to modify @INC before a given use statement is reached. Handily perl comes with the lib module to facilitate such @INC munging e.g
## this will modify @INC before the next 'use' statement use lib "/home/user/scripts"; use kp1;
Also note that I didn't use the lexical variable $dir as that will be declared at compile-time but won't be initialized until run-time (although you can get around this by using a BEGIN block).
HTH

_________
broquaint