[Chicago-talk] Perl script cannot find itself?

tiger peng tigerpeng2001 at yahoo.com
Thu Jun 16 13:47:39 PDT 2011



There are two Perl scripts only different by the first line. Why the one without -w in the #! line cannot find itself but the own with -w can?


OS: Linux 2.4.5 #6 SMP
Perl:  v5.8.0



/tmp>$ sdiff test.pl test1.pl
#!/usr/local/bin/perl                                         | #!/usr/local/bin/perl -w
system ('which perl');                                          system ('which perl');
print "hi\n";                                                   print "hi\n";


/tmp>$ test.pl
ksh: test.pl: No such file or directory
:/tmp>$ ./test.pl
ksh: ./test.pl: No such file or directory
/tmp>$ /tmp/test.pl
ksh: /tmp/test.pl: No such file or directory
/tmp>$ perl test.pl
/usr/local/bin/perl
hi

/tmp>$  test1.pl
/usr/local/bin/perl
hi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20110616/6652dc38/attachment.html>


More information about the Chicago-talk mailing list