in reply to match with exception

I'd be inclined to use the "does not match" feature of !~:
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; my $string = "asdfxyzasdf"; print "Not found\n" if($string !~ /xyz/);
Of course, that assumes a regular expression is the best way of (not) matching your string -- if it's just a simple string, then the perl function index() may be more suitable.
Edit: Changed wording to more accurately reflect test.