perl -V from the commandline gives the version at the top of the output; directories where your modules are installed (@INC: list) at the bottom and lots of other information in between.
| [reply] [d/l] [select] |
$which perl or whereis perl | [reply] |
Since you said "May be C:\My_Docs\Perl or C:\Perl or D:\Perl" then I will assume you are running on Windows.
The problem is that you might have more than one version installed, but Windows has a fundamental problem with that. When you type perl on the command-line (cmd.exe) it attempts to load perl.exe usings its executatble search mechanism, which is complex, but usually involves the %PATH% environment variable (use the path cmd.exe command to check).
However, when you run a perl script from the command-line, the shell uses the file association in the registry. You can check this, for example: C:\>assoc .pl
.pl=Perl
C:\>ftype Perl
Perl="C:\Perl\bin\perl.exe" "%1" %*
In theory the %PATH% and file association might refer to different versions. You mentioned "$Perl Script$": I'm not sure what that is but it could be the ftype? If so, make sure you enclose it in double quotes to find the location. | [reply] [d/l] [select] |
While I can't vouch for its portability, this worked for me on WinXP's cmd.exe.. And, like the OP kind of asked, it's done using Perl :)
perl -E "say 'Path: ', $^X; say 'Version: ', $^V" | [reply] [d/l] |
Just to be different: This will give you the installed perl version and the path of the installed perl.
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec;
use SVN::Notify;
my $exe_name = 'perl';
my $exe = SVN::Notify->find_exe($exe_name);
print "Perl $]\n";
print "$exe\n";
| [reply] [d/l] |