I'm not sure I understand your reply. Anything you do in a shell script can be done in a perl script (except for setting environment variables in the shell that invokes the perl script -- you can only do that if you "source" a shell script).
If both windows and unix/linux systems are reading "Script1.pl" from the same disk/directory on your local network (assuming this script is already written to be OS-independent), and all you need to worry about is whether the version of perl running your script is recent enough, you can include a statement like this in the script:
require 5.006001; # die if we're running under an older perl version
On the other hand, if there really are different versions of the script targeted for different systems (or different versions of perl), you can always find a way to integrate these variations into a single script that runs properly in each environment, by checking the OS type and perl version, using perl's internal global variables (cf. perlvar
), refactoring the code in a sensible way to simplify the branching for the different environments.
Anyway, I really can't figure out what you meant by this:
the main thing to do is to use same version of perl for any user independent of what they have in their machines
What people "have in their machines" (in terms of what version of perl is installed) is going to determine what happens when they run your script, regardless of how you write it or wrap it. If their version of perl is too old, either the script will die because you put a "require" statement for a minimum perl version number, or else (if you don't have that statement) it will die or do something bad because the older perl doesn't know what to do with your script.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.