> > my ($match) = $s =~ /some reg expression or perl code here to match foo/; > Stuart's suggestion works: ........ my $want = "foo"; my ($match) = $s =~ /\b($want)\b/; ....... produces s=foo,bar,baz match=foo s=bar,foo,baz match=foo s=bar,baz,foo match=foo s=bar,food,baz no match