Dave's Brain

Browse - Programming Tips - How I can dynamically tell if I am running Perl 5?

Date: 2008oct20
Language: perl

Q.  How I can dynamically tell if I am running Perl 5?

A.  This subroutine does the trick:

sub isPerl5() { return $] =~ m/^5\./ } sub exampleUse() { if (isPerl5()) { print "This IS Perl 5\n"; } else { print "This is NOT Perl 5\n"; } }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.