in reply to Invoking Perl on a script, vs. using shebang

Running:

strace ./backup
should shed some light on the problem.

Also, make sure the file is properly newline terminated (I've sometimes seen weird problems running shell scripts transferred from Windows that were terminated with \r\n).

Replies are listed 'Best First'.
Re^2: Invoking Perl on a script, vs. using shebang
by liverpole (Monsignor) on Feb 19, 2006 at 05:45 UTC
        ... make sure the file is properly newline terminated ...

    Very good point.  I actually considered that, though, because I had had exactly such a problem at work about 3 or 4 days ago (a Linux tarball was unzipped on Windows, then put back together, and none of the scripts in it behaved correctly -- turned out they had all been converted to [dos] format).  So I had already done a dos2unix on "hello.pl", with no change in the results.

    As far as running strace, I hadn't think of that, and it's a very good suggestion too.  Unfortunately, running it on the simple hello.pl program doesn't yield significant differences between the two.  Most of the differences are memory locations, with the exception of a complaint about some invalid ioctl in /dev/urandom (but that happens with the strace on the version of hello in /var/www/html, which is the working one).  Otherwise, they both indicate the same values for what was (supposedly) being output.


    @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"