use strict; use warnings; use Test::More tests => 2; my $corpus = q{foobar}; my $lookfor = q{}; my $res = index ($corpus, $lookfor) + 1; ok $res, 'Substring found'; $corpus = 'Something else'; $res = index ($corpus, $lookfor) + 1; ok !$res, 'Substring not found';