http://www.perlmonks.org?node_id=997522


in reply to Re: how to run this script
in thread how to run this script

thanks ..its working. whats the difference between running a perl script with command ./filename and perl filename . when i do ./filename it gives error bash: ./test.pm: Permission denied Please help

Replies are listed 'Best First'.
Re^3: how to run this script (permissions)
by toolic (Bishop) on Oct 05, 2012 at 17:25 UTC
    when i do ./filename it gives error bash: ./test.pm: Permission denied
    You probably need to give your test.pm file execute permissions, like:
    chmod 777 test.pm

    Also, conventionally, the .pm file name suffix is reserved for Perl module files (see package). It is more common to use the .pl file extension for scripts.

      chmod 777 test.pm

      Far too permissive!

      That gives every man and his dog permission to run, modify or even delete the script, if they are able to browse to the directory containing it. Much safer would be

      chmod u+x test.pm

      We see, and have to try to fix, the chaos that ensues when someone does an ill-considered

      chmod -R 777 /some/path/with_lots_of/sub-directories

      and it is a practice strongly to be discouraged.

      Cheers,

      JohnGG