my $re = qr/(${ \$obj->gimme_sweet_love })/; for my $match ( qw(yes yeah ja jup ok) ) { print "\$match value:", $match; print "HURAY (m)" if $match =~ m/$re/; print "count = ".$obj->cnt; }