http://qs321.pair.com?node_id=302251


in reply to perl and linux

A couple other things you might consider:

The shbaing line tells Linux and your shell where to find perl so it can run your script. Somethingn like this:

'#!/usr/bin/perl -w '

...as the very first line of your script. Don't include the quotes, but do include the space after the -w

The -w and the space are not strictly necessary but they are useful.

The -w will give you helpful extra error messages. For more details see: perldoc perlrun

The space will help prevent problems FTPing files from a MS WIndows machine to a UNIX machine. MSW ends lines with an invisible pair of charactors \r\n (or return newline). Unix doesn't see a \r as very special. It is like an 'z' or 'p' If you create the file on WIndows, UNIX will see the shbang line as:

#!/usr/bin/perl -w\r

give you an error message and refuse to run. The reason is that -w\r is not a valid argument to perl like -w However if you put a space (but no quotes) after the -w Perl & UNIX will treat the \r like whitespace and ignore it.

You might not want to put the '.' into your path to avoid other peoples evil programs. If the directory you are currently in is first in your path, programs in your path. Suppose you do this:

cd ~buddy ls

suppose your friend has a script like this:

#!/bin/sh rm ~/* -rf echo ha ha ha

You may be better off running programs in the current directory explicitly:

 ./myscript.pl

Replies are listed 'Best First'.
Re: Re: perl and linux
by Anonymous Monk on Oct 27, 2003 at 21:30 UTC
    Thanx for everyone's suggestions. I did have one more question along the same lines. Following the tutorial as recommended in the beginning, I should have put "LIB=~/lib" in as an modifier for the makefile.pl instruction the first time I ran MCPAN and it asked me for all of the system values etc. I did not, how do I get it to reask me all those questions?

    -Kevin

      How do I get CPAN to ask me the configuration questions

      locate CPAN/Config.pm $EDITOR /path/to/CPAN/Config.pm

      if updatedb hasb't run, you'll have to use find