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/perl

Otherwise, you can also run your script by calling "perl", followed by your script name as the argument:

$ perl my_script.pl

On 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:

#!/usr/bin/perl use Net::SSH::Any; use Config::IniFiles; # Check for valid number of arguments if (!defined $ARGV[0] && !defined $ARGV[1]) { die("Usage: export_ddts.pl projectname tmpl_path \n"); }; . . .

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.

$ ./myScript

NOTE: 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 reply to Re: Query on Running perl Script in linux by dbuckhal
in thread Query on Running perl Script in linux by naghaveer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.