use FindBin qw($Bin); # Set current directory to the # one which contains the script. chdir($Bin);