Assuming you're running a bash or bashlike or some such, it will search $PATH for the program you are attempting to run. Note that perl it self won't search $PATH, so saying "perl foo.pl" will always try to execute foo.pl in the current directory. The solution is to use the appropiate shebang at the top of your script and to set it executable, so bash can execute it from anywhere in your $PATH.