On Mon, 23 Nov 2009 08:10:48 -0500, Shawn H Corey wrote:
> abhi jain wrote:
>> I want to know which perl has called my program.
>> 
>> For Ex : If I call perl program as bellow.
>> 
>> # /usr/bin/perl5.8.5 prog.pl
>> I should get /usr/bin/perl5.8.5
>> 
>> # /usr/bin/perl5.8.8 prog.pl
>> I should get /usr/bin/perl5.8.8
>> 
> The version is stored in the special variable $^V that is, a dollar sign
> and control-V.  The version and patch level is stored in $]
> 
> my ( $major_version, $minor_version, $patch_level ) = $] =~ m{ \A (\d+)
> \. (\d\d\d) (\d\d\d) \z }msx;
> 
> See `perldoc perlvar` and search for /\$\]/
> http://perldoc.perl.org/perlvar.html#%24]

And the path to the perl is in $^X :

$ perl -le ' print "$^V $] $^X"'
v5.10.0 5.010000 /usr/local/bin/perl

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to