use strict;
use warnings;
use Test::More tests => 2;
like( foo(), qr/\d+/, "there are some digits in the result" );
like( bar(), qr/\d+/, "there are some digits in the result" );
sub foo {
return "This is a long text with a number 42 in it";
}
sub bar {
return "This is another string with no number in it";
}
1..2
ok 1 - there are some digits in the result
not ok 2 - there are some digits in the result
# Failed test 'there are some digits in the result'
# at t/like.t line 8.
# 'This is another string with no number in it'
# doesn't match '(?^:\d+)'
# Looks like you failed 1 test of 2.