I'm sorry if this had been asked, but I found it hard to search for.
I use Perl 5.12 locally but some of our machines use Perl 5.8.8 and they won't be updated for the time being.
For auditing I use 'say' on platform 5.12.
I've written a simple function to implement say on 5.8.8 but I don't want to use it on 5.12.
Is there a way to only use my say function on the older version of Perl and use the 'builtin' version of say on 5.12?
You can use the $^V
special variable to determine the version of the Perl interpreter:
BEGIN {
if ($^V ge v5.10.1) { # "say" first appeared in 5.10
require feature;
feature->import('say');
}
else {
*say = sub { print @_, "\n" }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With