Apurva Shukla wrote:
> Hi All,
>
> 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.
#!perl -w --
use strict;
# the path to the perl.exe you are running:
print "$^X\n";
# to find the path to the script you are executing:
print "Not necessarily the full path: $0\n";
use FindBin qw($RealScript $RealDir);
print "Full path: $RealDir/$RealScript\n";
__END__
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs