Here's a more annoying way than Peter's in the event that you dont add perl to your path (heaven knows why one of my client opted for that!)
$version = $Registry-> {'LMachine/SOFTWARE/ActiveState/ActivePerl//CurrentVersion'}; $gbl_PerlPath = $Registry-> {'LMachine/SOFTWARE/ActiveState/ActivePerl/' . $version . '//'}; Wee!
Here's one way:
###
for $dir (split(/;/,$ENV{'PATH'}))
{
{
opendir(DIR, "$dir") || die "Can't open $dir for reading :
$!\n";
while ($_ =
readdir(DIR))
{
print "$dir\n" if ($_ eq 'perl.exe');
}
{
print "$dir\n" if ($_ eq 'perl.exe');
}
close(DIR);
}
}
-----Original Message-----Hi All,
From: Apurva Shukla [mailto:[EMAIL PROTECTED]
Sent: Friday, July 08, 2005 9:56 AM
To: perl-win32-users@listserv.ActiveState.com
Subject: How to find the perl install directory?
I have perl installed on my system at C:\Perl.
now I need to write a script which if I run on any computer gives me the directory where perl is installed.
For e.g. on my system it should be
$perl whereisperl.pl
c:\Perl
{Factually what I really want to do is:
$whereisperl.bat
c:\Perl
}
I have tried seeing enviroment variables but none of the environment variables store any informatio except the PATH which stores a link to it and that too is filled with a huge number of paths. One option could be to parse that and get the path to Perl install directory but I feel there has to be a neater way. Also another problem I have is that I want to write a bat file so parsing is a little problem i want to avoid.
TIA
--
Apurva Shukla
---------------------
dream & dare
---------------------
This message was scanned by ATX
10:49:26 AM ET - 7/8/2005
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs