Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

perl file doesn't execute

by subhash_fire (Novice)
on Oct 15, 2011 at 06:40 UTC ( #931625=perlquestion: print w/ replies, xml ) Need Help??
subhash_fire has asked for the wisdom of the Perl Monks concerning the following question:

I have a perl file when I tried to execute on cygwin platform it just comes back to the shell prompt without any output.When I purposefully gave the syntax error it throws the error and also shows the error line as 1. Later when I rename the file it works. This seems weird for me.

Comment on perl file doesn't execute
Re: perl file doesn't execute
by Anonymous Monk on Oct 15, 2011 at 06:56 UTC

    See How do I post a question effectively?

    I'm guessing your line endings are not LF or CRLF, along with your shebang, so try

    #!/usr/bin/perl -- die $^X;

    I think I remember seeing this once with CR line endings, but I'm not gonna check :)

      Perhaps subhash_fire can post some code; a lot of us are running Cygwin + Perl and can review. When you install Cygwin you get to choose file type (Unix or Dos) which really means you're choosing what kind of newline terminator you would like to use.
Re: perl file doesn't execute
by Marshall (Prior) on Oct 15, 2011 at 12:32 UTC
    Start with the classic "hello World" program. Make a file like this:

    #!/usr/bin/perl -w use strict; print "Hello World\n";
    Save that file as "Hello.pl"
    do a ls -al ....you should see that file...
    make sure that this file has execute permissions: chmod Hello.pl u +rx
    type ls -al Hello.pl at the comand line...just will list the program... then type just Hello.pl and the program should run...
Re: perl file doesn't execute
by blue_cowdawg (Monsignor) on Oct 15, 2011 at 13:59 UTC

    You leave a lot to interpretation. If you want useful answers how about:

    • Showing us your code.
    • What permissions you stored the file as
    • what was the original name?
    • What is you script trying to accomplish and is failing at?


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
      This is solid advice and I up voted your post. If I could give it two votes, I would!

      I have cygwin (a different Perl) on my Windows machine and also an Active State Perl. I strongly recommend a simple "hello world" program and getting that working.

      Showing code is important! The OP should get something simple working and then we can talk about getting something more complex working.

        Thanks, the file which I am using is having more than 1000 lines which is actually related to testing. Sorry for that I can't help on providing the code.. but i will surely give a simple code which will come across this problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://931625]
Approved by lidden
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2014-10-21 14:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (104 votes), past polls