On Fri, Dec 20, 2002 at 12:11:42PM -0000, Rob Dixon wrote:
> We make a good team Paul ;-}
:-)
But you do actually need the parens in the index call, otherwise the
precedence is wrong:
$ perl -MO=Deparse,-p -e '@match = grep { index $_, $string >= 0 and $_ ne $string }
@array;'
(@match = grep({(index($_, ($string >= 0)) and ($_ ne $string));} @array));
-e syntax OK
Which doesn't do quite what you want :-(
> "Paul Johnson" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > I don't know about better, but why not code it exactly as you describe
> > it?
> >
> > @match = grep { index($_, $string) >= 0 and $_ ne $string } @array;
> >
> > This has the advantage of not needing to escape the meta characters so
> > you won't get false positives. Add xmailxcom to @array.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]