!/usr/bin/env perl use strict; use warnings; use Test::More qw(no_plan); my $string = "abc\ndef\nghi"; # (1) Passes like($string, qr/def/m, 'found def'); # (2) Passes like($string, qr/^def/m, 'found ^def'); # (3) Fails like($string, qr/def$/m, 'found def$'); # (4) Fails - this is the test I want to run like($string, qr/^def$/m, 'found ^def$'); # (5) Passes ok(($string =~ m/^def$/m), 'found ^def$'); # (6) Passes - supposedly the equivalent of (4)? ok(($string =~ m/(?m-xis:^def$)/), 'found ^def$');