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.
You can execute any system command and capture STDOUT with qx:
use warnings;
use strict;
my $v = qx(python -V);
print $v;