How to find which perl has called my program?

How to find which perl has called my program?

am 21.11.2009 09:48:27 von abhi jain

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

Thanks in advance
Abhi Jain


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

Re: How to find which perl has called my program?

am 23.11.2009 14:10:48 von Shawn H Corey

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
>
> Thanks in advance
> Abhi Jain
>
>

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]


--
Just my 0.00000002 million dollars worth,
Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

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

Re: How to find which perl has called my program?

am 23.11.2009 16:39:48 von Peter Scott

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-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/