use File::Basename; $config = shift @ARGV; $dir = dirname $0; chdir $dir; open F, "<$config" or die "Can't open $config: $!\n"; ... parse $config file here ...