Spidy has asked for the wisdom of the Perl Monks concerning the following question:

Greetings fellow Monks,
I'm using Mac OS X 10.4(tiger), and I'm wondering where I would save my perl scripts to, directory wise, in order to be able to run them directly from the terminal, without having to move around the directories or anything. Ideally, I'd like to just be able to type "perl myscript.pl". Does anyone know where I would save them to?

Thanks,
Spidy

Replies are listed 'Best First'.
Re: Where to save perl scripts on a mac?
by BUU (Prior) on Jun 28, 2005 at 05:20 UTC
    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.
      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.
      Which is why you should use the -S switch ("perl -S foo.pl"), to tell perl to search $PATH :)

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

        Well, I didn't know about the -S switch, but it's still clumsy to have to type perl -S in front of everything.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Where to save perl scripts on a mac?
by Fletch (Bishop) on Jun 28, 2005 at 12:35 UTC

    You might also be interested in either Platypus or DropScript (google or versiontracker can point you at a download location), both of which will wrap a Perl script (or any executable or other interpreted language script for that matter) up into a full application which you can run from the Finder by double clicking (or drop files onto).

    --
    We're looking for people in ATL

A reply falls below the community's threshold of quality. You may see it by logging in.