Your file has a bunch of binary carriage returns in it. Looks like you did not correctly transfer the file from a non-Unix OS to Unix (or vice-versa) in ASCII form. The problem occurs because *with* the -w flag, the carriage return can be safely ignored by Perl, however, without it, your line looks something like this:
#!/usr/bin/perl^M
Since the carriage return has to be treated as if it were a normal ASCII byte, it's looking for the binary perl^M to execute your script, not perl. Thus, you get "not found".
The fix: Transfer the file again correctly, dropping the carriage returns. Alternatively, you can use the search/replace feature in, say, vi, to strip them out: :%s/^V^M//g (where the ^V is a control-V (quote the next character) and the ^M is a control-M), or use something similar in a Perl one-liner. | [reply] [d/l] [select] |
You can also do the following, which is a little easier, IMHO.
vi nastyDOSfile.pl
:set ff=unix
:wq
'ff' is a synonym for 'fileformat'. I imagine there's some useful little command line utility that could process all the files in a directory, but I'm not THAT much of a Unix hack.
--Chris
e-mail jcwren | [reply] [d/l] |
perl -pi.dos -e 's/\r//'
Doing this under DOS is harder since you have to get the
calls to binmode thrown in at the right places.
I think you can check the FAQ for more info.
-
tye
(but my friends call me "Tye") | [reply] [d/l] [select] |
yes, that does appear to be it....
this script was written by a co-worker who does his editing on win32...I've never seen this before...very interesting. Anyway, i've had him set his editor up to output in UNIX format so all should be well.
"sometimes when you make a request for the head you don't
want the big, fat body...don't you go snickering."
-- Nathan Torkington UoP2K a.k.a gnat
| [reply] |
$ cat -vet rep_input.cgi
#!/usr/bin/perl -w ^M$
^M$
use strict;^M$
use CGI qw(:all);^M$
require 'include.pl';^M$
$! = 1;^M$
print header; ^M$
use DBI;^M$
^M$
my $REP_FNAME^I^I= uc( param('rep_fname') ); ^M$
my $REP_LNAME^I^I= uc( param('rep_lname') ); ^M$
"sometimes when you make a request for the head you don't
want the big, fat body...don't you go snickering."
-- Nathan Torkington UoP2K a.k.a gnat
| [reply] [d/l] |