Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perl script to get Python's version

Tags:

perl

Is there an easy way to get the version of Python from a Perl script? For example, get the equivalent of the version python -V. I need this to determine if I need to run python26 or just python on some of my linux boxes.

If there isn't an easy way, I plan to run the python -V then capture stdout and parse it.

like image 568
James Oravec Avatar asked Aug 26 '26 03:08

James Oravec


1 Answers

You can execute any system command and capture STDOUT with qx:

use warnings;
use strict;

my $v = qx(python -V);
print $v;
like image 177
toolic Avatar answered Aug 29 '26 04:08

toolic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!