bash: ./scriptname.pl: No such file or directory
By adding the dot slash before the script name, you're telling the shell to open that script and figure out from the shebang line which program to execute it with. Thus, it is not Perl complaining about syntax issues as Perl is never found. The "no such file or directory" is due to the \r at the end of the shebang. Running cat -vE scriptname.pl will show those extra newlines as a cntl-M:
$ cat -vE test.pl
#!/usr/bin/perl -w^M$
use strict;^M$
^M$
my $log = './logfile';^M$
Without the warnings switch, the shebang would look like this:
$ cat -vE test.pl
#!/usr/bin/perl^M$
The shell thinks the cntl-M is part of the filename, thus giving you the 'no such file' error.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats. |