If print/say is the only issue, changing -E to -le will make print work the same as say.
Furthermore, that will work in very old Perls (at least 5.6, but I expect much earlier).
I often find I need to check the versions of multiple modules so I wrote this function for that:
perlmodver () {
for i in "$@"; do
eval "echo \`perl -E 'no warnings q{deprecated}; use $i; say q
+q{$i }, \$$i::VERSION'\`"
done
}
Example usage:
$ perlmodver DBD::ODBC DBD::SQLite DBI
Can't locate DBD/ODBC.pm in @INC (you may need to install the DBD::ODB
+C module) (@INC contains: /Users/ken/local/lib/perl /Users/ken/perl5/
+perlbrew/perls/perl-5.22.0t/lib/site_perl/5.22.0/darwin-thread-multi-
+2level /Users/ken/perl5/perlbrew/perls/perl-5.22.0t/lib/site_perl/5.2
+2.0 /Users/ken/perl5/perlbrew/perls/perl-5.22.0t/lib/5.22.0/darwin-th
+read-multi-2level /Users/ken/perl5/perlbrew/perls/perl-5.22.0t/lib/5.
+22.0 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
DBD::SQLite 1.46
DBI 1.633
|