[tpm] [Fwd: Re: String matching at start or middle or end of list]

arocker at Vex.Net arocker at Vex.Net
Mon Apr 29 12:07:57 PDT 2013


>
>  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






More information about the toronto-pm mailing list