kid12321 has asked for the wisdom of the Perl Monks concerning the following question:

hello, I installed Cygwin on C:/Cygwin. I run hello.pl but error: #!/Cygwin/bin/perl pemission denied. I tried: chmod +x perl.exe but not run. Can you help me? thanks best regard, Kid
  • Comment on Getting 'permission denied' error trying to run perl under cygwin

Replies are listed 'Best First'.
Re: Getting 'permission denied' error trying to run perl under cygwin
by Corion (Patriarch) on Jun 17, 2009 at 09:45 UTC

    Cygwin attempts to make Unix paths appear on Windows, which means that programs written with a Unix system in mind will work, but anything using a Windows path will not work. The likely fix for your program is not to think of Windows and to think you are on Unix:

    #!/bin/perl print "Hello World\n";

    or maybe

    #!/usr/bin/perl print "Hello World\n";

    ... or alternatively, use the Cygwin syntax to get at Windows files:

    #!/cygdrive/c/Cygwin/bin/perl print "Hello World\n";

    If you don't need the rest of the Cygwin utilities or libraries and just want to have Perl on Windows, I recommend using Strawberry Perl, which gives you Perl, a C compiler and the environment to install modules.

Re: Getting 'permission denied' error trying to run perl under cygwin
by McDarren (Abbot) on Jun 17, 2009 at 09:45 UTC
    perl.exe is already executable (I hope).

    You need to make your script executable, or pass it to perl. So either:

    chmod +x hello.pl
    or:
    perl hello.pl
Re: Getting 'permission denied' error trying to run perl under cygwin
by apl (Monsignor) on Jun 17, 2009 at 12:22 UTC
    Define
    I run hello.pl
    If you'd specified hello.pl, then your script is not executable, not should it (necessarily) be. You may have to specify perl hello.pl.
Re: Getting 'permission denied' error trying to run perl under cygwin
by Khen1950fx (Canon) on Jun 17, 2009 at 10:41 UTC
    I agree with McDarren. First, make sure that perl2exe is in your path. Then, from the commandline just:

    perl2exe -platform=Win32 myscript.pl

      McDarren makes no mention of indegoStar's perl2exe utility, the OP isn't asking how to convert a script to a stand alone executable.

      Martin