Ramprasad Yours isn't a general solution anyway, as any periods in your string will match any character in a list entry. I would use the plainer:
@match = grep { index $_, $string >= 0 and $_ ne $string } @array; Cheers, /R "Ramprasad" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hello all > > Assume the foll > > $string='mail.com'; > @array=qw(mail.com one.mail.com two.mail.com mail.com/one mail1.com); > > @match = grep{..}@array; > > I want to match all that *contain* $string but is not equal to $string > > so I came up with > > @match = grep{/^$string.+/ || /.+$string$/} @array; > > is there any better way > Thanks > Ram > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]