How to skip tests with Test::More

The following piece of code demonstrates how, using Test::More, to skip some tests for a particular Perl version. In this case, it tests for a version of 5.16. The Perl version variable is stored in $[.

use warnings;
use strict;
use Test::More tests => 2;
print "$]\n";
    skip "wrong version", 1 unless $] >= 5.016;
    ok (1, "Skip");
ok (1, "Ok");


Run with Perl 5.8.9, it produces the following output:

ok 1 # skip wrong version
ok 2 - Ok

Copyright © Ben Bullock 2009-2023. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( or use the discussion group at Google Groups. / Privacy / Disclaimer