laziness, impatience, and hubris | |
PerlMonks |
Re: Query on Running perl Script in linuxby dbuckhal (Chaplain) |
on Feb 25, 2014 at 04:45 UTC ( [id://1076085]=note: print w/replies, xml ) | Need Help?? |
If that is your exact code you are trying to use, then it is missing the "shebang!" line. In Windows, you probably have file association doing the work for you in relating your Perl script to whatever Perl you have installed (Strawberry, Activestate,etc...). But, on the Unix/Linux platform, you can add the program to execute your script on the first line: #!/usr/bin/perlOtherwise, you can also run your script by calling "perl", followed by your script name as the argument: $ perl my_script.plOn Unix/Linux, just type "which perl" at the prompt and that will tell you the path to use when you add the "shebang!" line at the top of your code So, your first few lines of you code would look like this:
The only thing left would to just make it executable: chmod +x myScript.pl...and you will be able to run it by just typing its name at the prompt. $ ./myScriptNOTE: this just assumes that your posted code is exactly what you are trying to execute and I just noticed the "shebang!" missing. If I'm way off target, my bad. :)
In Section
Seekers of Perl Wisdom
|
|