perl --version prints all this:
This is perl 5, version 26, subversion 1 (v5.26.1) built for darwin-thread-multi-2level Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
What I want is this:
Is there any out-of-the-box way to get that, or do I need to write my own regular expression to extract it from the verbose output?
The variable $^V has that information. You can print it directly from inside Perl:
#!/usr/bin/perl use strict; use warnings; print $^V;
or you can get it in bash:
perl -e 'print $^V'
Both versions print "v5.22.1" on my system.